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

Commit

Permalink
cleanup funcs to reflect twitter defaults & update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylow committed Feb 19, 2018
1 parent dea7a1a commit baf6170
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
14 changes: 7 additions & 7 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Version 3.4
===========

Deprecations
------------
++++++++++++

* :py:func:`twitter.api.Api.UpdateBackgroundImage`. Please make sure that your code does not call this function as it will now return a hard error. There is no replacement function. This was deprecated by Twitter around July 2015.

Expand Down Expand Up @@ -46,7 +46,7 @@ Version 3.2
===========

Deprecations
------------
++++++++++++

Nothing is being deprecationed this version, however here's what's being deprecated as of v. 3.3.0:

Expand All @@ -62,7 +62,7 @@ Nothing is being deprecationed this version, however here's what's being depreca


What's New
----------
++++++++++

* We've added new deprecation warnings, so it's easier to track when things go away. All of python-twitter's deprecation warnings will be a subclass of :py:class:`twitter.error.PythonTwitterDeprecationWarning` and will have a version number associated with them such as :py:class:`twitter.error.PythonTwitterDeprecationWarning330`.

Expand All @@ -80,7 +80,7 @@ What's New
* `video_info` is now available on a `twitter.models.Media` object, which allows access to video urls/bitrates/etc. in the `extended_entities` node of a tweet.

What's Changed
--------------
++++++++++++++

* :py:class:`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. `PR #375 <https://github.com/bear/python-twitter/pull/375>`_

Expand All @@ -90,7 +90,7 @@ What's Changed


Bugfixes
--------
++++++++

* :py:class:`twitter.models.Media` again contains a ``sizes`` attribute, which was missed back in the Version 3.0 release. `PR #360 <https://github.com/bear/python-twitter/pull/360>`_

Expand All @@ -106,7 +106,7 @@ Version 3.1
==========

What's New
____________
++++++++++

* :py:func:`twitter.api.Api.PostMediaMetadata()` Method allows the posting of alt text (hover text) to a photo on Twitter. Note that it appears that you have to call this method prior to attaching the photo to a status.

Expand All @@ -125,7 +125,7 @@ ____________


What's Changed
______________
++++++++++++++

* :py:func:`twitter.api.Api.GetStatus()` Now accepts the keyword argument ``include_ext_alt_text`` which will request alt text to be included with the Status object being returned (if available). Defaults to ``True``.

Expand Down
18 changes: 9 additions & 9 deletions tests/test_api_30.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ def testGetBlocks(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/blocks/list.json?cursor=-1&tweet_mode=compat',
'https://api.twitter.com/1.1/blocks/list.json?cursor=-1&stringify_ids=False&include_entities=False&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
with open('testdata/get_blocks_1.json') as f:
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/blocks/list.json?cursor=1524574483549312671&tweet_mode=compat',
'https://api.twitter.com/1.1/blocks/list.json?cursor=1524574483549312671&stringify_ids=False&include_entities=False&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand Down Expand Up @@ -278,15 +278,15 @@ def testGetBlocksIDs(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/blocks/ids.json?cursor=-1&tweet_mode=compat',
'https://api.twitter.com/1.1/blocks/ids.json?cursor=-1&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
with open('testdata/get_blocks_ids_1.json') as f:
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/blocks/ids.json?cursor=1524566179872860311&tweet_mode=compat',
'https://api.twitter.com/1.1/blocks/ids.json?cursor=1524566179872860311&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def testGetMutes(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/mutes/users/list.json?cursor=-1&tweet_mode=compat&include_entities=True',
'https://api.twitter.com/1.1/mutes/users/list.json?cursor=-1&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand All @@ -1377,7 +1377,7 @@ def testGetMutes(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/mutes/users/list.json?cursor=1535206520056388207&include_entities=True&tweet_mode=compat',
'https://api.twitter.com/1.1/mutes/users/list.json?cursor=1535206520056388207&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand All @@ -1392,7 +1392,7 @@ def testGetMutesIDs(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/mutes/users/ids.json?tweet_mode=compat&cursor=-1',
'https://api.twitter.com/1.1/mutes/users/ids.json?cursor=-1&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand All @@ -1402,7 +1402,7 @@ def testGetMutesIDs(self):
resp_data = f.read()
responses.add(
responses.GET,
'https://api.twitter.com/1.1/mutes/users/ids.json?tweet_mode=compat&cursor=1535206520056565155',
'https://api.twitter.com/1.1/mutes/users/ids.json?cursor=1535206520056565155&stringify_ids=False&include_entities=True&skip_status=False&tweet_mode=compat',
body=resp_data,
match_querystring=True,
status=200)
Expand All @@ -1416,7 +1416,7 @@ def testCreateBlock(self):
resp_data = f.read()
responses.add(
POST,
'https://api.twitter.com/1.1/blocks/create.json',
DEFAULT_URL,
body=resp_data,
match_querystring=True,
status=200)
Expand Down
19 changes: 10 additions & 9 deletions twitter/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,8 @@ def GetRetweeters(self,
url = '%s/statuses/retweeters/ids.json' % (self.base_url)
parameters = {
'id': enf_type('id', int, status_id),
'stringify_ids': enf_type('stringify_ids', bool, stringify_ids)
'stringify_ids': enf_type('stringify_ids', bool, stringify_ids),
'count': count,
}

result = []
Expand Down Expand Up @@ -1742,7 +1743,7 @@ def _GetBlocksMutesPaged(self,
action,
cursor=-1,
skip_status=False,
include_entities=False,
include_entities=True,
stringify_ids=False):
""" Fetch a page of the users (as twitter.User instances)
blocked or muted by the currently authenticated user.
Expand Down Expand Up @@ -1779,12 +1780,12 @@ def _GetBlocksMutesPaged(self,
url = urls[endpoint][action]

result = []
parameters = {}
if skip_status:
parameters['skip_status'] = True
if include_entities:
parameters['include_entities'] = True
parameters['cursor'] = cursor
parameters = {
'skip_status': bool(skip_status),
'include_entities': bool(include_entities),
'stringify_ids': bool(stringify_ids),
'cursor': cursor,
}

resp = self._RequestUrl(url, 'GET', data=parameters)
data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
Expand Down Expand Up @@ -1901,7 +1902,7 @@ def GetBlocksIDsPaged(self,
return self._GetBlocksMutesPaged(endpoint='block',
action='ids',
cursor=cursor,
stringify_ids=False)
stringify_ids=stringify_ids)

def GetMutes(self,
skip_status=False,
Expand Down

0 comments on commit baf6170

Please sign in to comment.