def __init__(self, auth_handler=None, host='twitter.com', cache=None,
secure=False, api_root='', validate=True,
- retry_count=0, retry_delay=0, retry_errors=[500,502,503]):
+ retry_count=0, retry_delay=0, retry_errors=None):
# you may access these freely
self.auth_handler = auth_handler
self.host = host
http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites%C2%A0create
"""
- create_favorite = bind_api(
- path = '/favorites/create.json',
- method = 'POST',
- parser = parse_status,
- allowed_param = ['id'],
- require_auth = True
- )
+ def create_favorite(self, id):
+ return bind_api(
+ path = '/favorites/create/%s.json' % id,
+ method = 'POST',
+ parser = parse_status,
+ allowed_param = ['id'],
+ require_auth = True
+ )(self, id)
""" favorites/destroy
http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites%C2%A0destroy
"""
- destroy_favorite = bind_api(
- path = '/favorites/destroy.json',
- method = 'DELETE',
- parser = parse_status,
- allowed_param = ['id'],
- require_auth = True
- )
+ def destroy_favorite(self, id):
+ return bind_api(
+ path = '/favorites/destroy/%s.json' % id,
+ method = 'DELETE',
+ parser = parse_status,
+ allowed_param = ['id'],
+ require_auth = True
+ )(self, id)
""" notifications/follow
resp = conn.getresponse()
# Exit request loop if non-retry error code
- if resp.status not in retry_errors:
- break
+ if retry_errors is None:
+ if resp.status == 200: break
+ else:
+ if resp.status not in retry_errors: break
# Sleep before retrying request again
time.sleep(retry_delay)