Add support for the Geo API and Place models · iCodeIN/python-twitter@15d703f · GitHub
Skip to content

Commit 15d703f

Browse files
committed
Add support for the Geo API and Place models
1 parent c878131 commit 15d703f

4 files changed

Lines changed: 181 additions & 0 deletions

File tree

tests/test_place.py

Lines changed: 141 additions & 0 deletions

twitter/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
Hashtag, # noqa
4646
List, # noqa
4747
Media, # noqa
48+
Place, # noga
4849
Trend, # noqa
4950
Url, # noqa
5051
User, # noqa

twitter/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Category,
5050
DirectMessage,
5151
List,
52+
Place,
5253
Status,
5354
Trend,
5455
User,
@@ -4648,6 +4649,12 @@ def GetUserStream(self,
46484649
elif include_keepalive:
46494650
yield None
46504651

4652+
def GetPlace(self, id):
4653+
url = '{}/geo/id/{}.json'.format(self.base_url, id)
4654+
resp = self._RequestUrl(url, 'GET')
4655+
data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
4656+
return Place.NewFromJsonDict(data)
4657+
46514658
def VerifyCredentials(self, include_entities=None, skip_status=None, include_email=None):
46524659
"""Returns a twitter.User instance if the authenticating user is valid.
46534660

twitter/models.py

Lines changed: 32 additions & 0 deletions

0 commit comments

Comments
 (0)