Fixing code (errors from tests), update HISTORY
[ci skip]
This commit is contained in:
parent
4debef7d84
commit
f6040fe275
4 changed files with 11 additions and 22 deletions
|
|
@ -17,6 +17,7 @@ History
|
|||
- Developers can now pass an array as a parameter to Twitter API methods and they will be automatically joined by a comma and converted to a string
|
||||
- ``endpoints.py`` now contains ``EndpointsMixin`` (rather than the previous ``api_table`` dict) for Twython, which enables Twython to use functions declared in the Mixin.
|
||||
- Added OAuth 2 authentication (Application Only) for when you want to make read-only calls to Twitter without having to go through the whole user authentication ritual (see docs for usage)
|
||||
- ``construct_api_url`` now accepts keyword arguments like other Twython methods (e.g. instead of passing ``{'q': 'twitter', 'result_type': 'recent'}``, pass ``q='twitter', result_type='recent'``)
|
||||
|
||||
2.10.1 (2013-05-29)
|
||||
++++++++++++++++++
|
||||
|
|
|
|||
|
|
@ -57,18 +57,9 @@ class TwythonAPITestCase(unittest.TestCase):
|
|||
def test_construct_api_url(self):
|
||||
"""Test constructing a Twitter API url works as we expect"""
|
||||
url = 'https://api.twitter.com/1.1/search/tweets.json'
|
||||
constructed_url = self.api.construct_api_url(url, {'q': '#twitter'})
|
||||
constructed_url = self.api.construct_api_url(url, q='#twitter')
|
||||
self.assertEqual(constructed_url, 'https://api.twitter.com/1.1/search/tweets.json?q=%23twitter')
|
||||
|
||||
def test_shorten_url(self):
|
||||
"""Test shortening a url works"""
|
||||
self.api.shorten_url('http://google.com')
|
||||
|
||||
def test_shorten_url_no_shortner(self):
|
||||
"""Test shortening a url with no shortener provided raises TwythonError"""
|
||||
self.assertRaises(TwythonError, self.api.shorten_url,
|
||||
'http://google.com', '')
|
||||
|
||||
def test_get(self):
|
||||
"""Test Twython generic GET request works"""
|
||||
self.api.get('account/verify_credentials')
|
||||
|
|
@ -386,10 +377,6 @@ class TwythonAPITestCase(unittest.TestCase):
|
|||
|
||||
self.api.delete_list(list_id=list_id)
|
||||
|
||||
def test_get_list_memberships(self):
|
||||
"""Test list of lists the authenticated user is a member of succeeds"""
|
||||
self.api.get_list_memberships()
|
||||
|
||||
def test_get_list_subscribers(self):
|
||||
"""Test list of subscribers of a specific list succeeds"""
|
||||
self.api.get_list_subscribers(list_id=test_list_id)
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class Twython(EndpointsMixin, object):
|
|||
if self.access_token: # If they pass an access token, force OAuth 2
|
||||
oauth_version = 2
|
||||
|
||||
self.oauth_version = oauth_version
|
||||
|
||||
# OAuth 2
|
||||
if oauth_version == 2:
|
||||
self.request_token_url = self.api_url % 'oauth2/token'
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.get('statuses/user_timeline', params=params)
|
||||
|
||||
def get_home_timline(self, **params):
|
||||
def get_home_timeline(self, **params):
|
||||
"""Returns a collection of the most recent Tweets and retweets
|
||||
posted by the authenticating user and the users they follow.
|
||||
|
||||
Docs: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
|
||||
|
||||
"""
|
||||
return self.get('statuses/home_timline', params=params)
|
||||
return self.get('statuses/home_timeline', params=params)
|
||||
|
||||
def retweeted_of_me(self, **params):
|
||||
"""Returns the most recent tweets authored by the authenticating user
|
||||
|
|
@ -89,7 +89,7 @@ class EndpointsMixin(object):
|
|||
Docs: https://dev.twitter.com/docs/api/1.1/post/statuses/update
|
||||
|
||||
"""
|
||||
return self.post('statuses/update_status', params=params)
|
||||
return self.post('statuses/update', params=params)
|
||||
|
||||
def retweet(self, **params):
|
||||
"""Retweets a tweet specified by the id parameter
|
||||
|
|
@ -119,7 +119,7 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.get('statuses/oembed', params=params)
|
||||
|
||||
def get_retweeters_id(self, **params):
|
||||
def get_retweeters_ids(self, **params):
|
||||
"""Returns a collection of up to 100 user IDs belonging to users who
|
||||
have retweeted the tweet specified by the id parameter.
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ class EndpointsMixin(object):
|
|||
Docs: https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug/members
|
||||
|
||||
"""
|
||||
return self.get('users/suggestions/%s/members' % param['slug'], params=params)
|
||||
return self.get('users/suggestions/%s/members' % params['slug'], params=params)
|
||||
|
||||
# Favorites
|
||||
def get_favorites(self, **params):
|
||||
|
|
@ -531,7 +531,6 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.post('lists/members/destroy', params=params)
|
||||
|
||||
|
||||
def get_list_subscribers(self, **params):
|
||||
"""Returns the subscribers of the specified list.
|
||||
|
||||
|
|
@ -562,7 +561,7 @@ class EndpointsMixin(object):
|
|||
Docs: https://dev.twitter.com/docs/api/1.1/post/lists/subscribers/destroy
|
||||
|
||||
"""
|
||||
return self.get('lists/subscribers/destroy', params=params)
|
||||
return self.post('lists/subscribers/destroy', params=params)
|
||||
|
||||
def create_list_members(self, **params):
|
||||
"""Adds multiple members to a list, by specifying a comma-separated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue