Added create_metadata endpoint #460
1 changed files with 9 additions and 4 deletions
|
|
@ -140,7 +140,11 @@ class Twython(EndpointsMixin, object):
|
||||||
params = params or {}
|
params = params or {}
|
||||||
|
|
|||||||
|
|
||||||
func = getattr(self.client, method)
|
func = getattr(self.client, method)
|
||||||
params, files = _transparent_params(params)
|
if type(params) is dict:
|
||||||
|
params, files = _transparent_params(params)
|
||||||
|
else:
|
||||||
|
params = params
|
||||||
|
files = list()
|
||||||
|
|
||||||
requests_args = {}
|
requests_args = {}
|
||||||
for k, v in self.client_args.items():
|
for k, v in self.client_args.items():
|
||||||
|
|
@ -192,15 +196,16 @@ class Twython(EndpointsMixin, object):
|
||||||
error_message,
|
error_message,
|
||||||
|
Can you make this line:
Can you make this line:
`if response.content != ''` (spaces around operator and single quotes
`content = ''` Space around operators and single quotes
|
|||||||
error_code=response.status_code,
|
error_code=response.status_code,
|
||||||
retry_after=response.headers.get('X-Rate-Limit-Reset'))
|
retry_after=response.headers.get('X-Rate-Limit-Reset'))
|
||||||
|
content=""
|
||||||
try:
|
try:
|
||||||
if response.status_code == 204:
|
if response.status_code == 204:
|
||||||
content = response.content
|
content = response.content
|
||||||
else:
|
else:
|
||||||
content = response.json()
|
content = response.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise TwythonError('Response was not valid JSON. \
|
if response.content!="":
|
||||||
Unable to decode.')
|
raise TwythonError('Response was not valid JSON. \
|
||||||
|
Unable to decode.')
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue
Can you make this
if isinstance(params, dict)