Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 2f222c7

Browse files
authored
Merge pull request #375 from bear/fix/issue374
tweet_volume not being populated for Trend objects
2 parents 99e0cff + 138ca2e commit 2f222c7

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

doc/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
---------
33

4+
Version 3.2
5+
===========
6+
7+
What's Changed
8+
--------------
9+
10+
* :py:func:`twitter.models.Trend`'s `volume` attribute has been renamed `tweet_volume` in line with Twitter's naming convention. This change should allow users to access the number of tweets being tweeted for a given Trend.
11+
412
Version 3.1
513
==========
614

testdata/models/models_trend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"#ChangeAConsonantSpoilAMovie","url":"http:\\/\\/twitter.com\\/search?q=%23ChangeAConsonantSpoilAMovie","promoted_content":null,"query":"%23ChangeAConsonantSpoilAMovie","tweet_volume":null}
1+
{"name":"#ChangeAConsonantSpoilAMovie","url":"http:\\/\\/twitter.com\\/search?q=%23ChangeAConsonantSpoilAMovie","promoted_content":null,"query":"%23ChangeAConsonantSpoilAMovie","tweet_volume":104403}

tests/test_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def test_trend(self):
116116
self.fail(e)
117117
self.assertTrue(trend.AsJsonString())
118118
self.assertTrue(trend.AsDict())
119+
self.assertEqual(trend.tweet_volume, 104403)
120+
self.assertEqual(trend.volume, trend.tweet_volume)
119121

120122
def test_url(self):
121123
url = twitter.Url.NewFromJsonDict(self.URL_SAMPLE_JSON)

twitter/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def __init__(self, **kwargs):
208208
'query': None,
209209
'timestamp': None,
210210
'url': None,
211-
'volume': None,
211+
'tweet_volume': None,
212212
}
213213

214214
for (param, default) in self.param_defaults.items():
@@ -220,6 +220,10 @@ def __repr__(self):
220220
self.timestamp,
221221
self.url)
222222

223+
@property
224+
def volume(self):
225+
return self.tweet_volume
226+
223227

224228
class Hashtag(TwitterModel):
225229

0 commit comments

Comments
 (0)