Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added create_metadata endpoint #460

Merged
merged 3 commits into from Oct 9, 2017
Merged

Conversation

jmdaweb
Copy link
Contributor

@jmdaweb jmdaweb commented Oct 7, 2017

I have added the create_metadata endpoint for image descriptions. Now it should pass all tests. The following modifications have been made to api.py:

  • JSON exception will raise only if response content is not empty.
  • _transparent_params is only called if params is a dictionary

…mpty and the status code is not 204. If params is not a dictionary, _transparent_params is not called
@coveralls
Copy link

coveralls commented Oct 7, 2017

Coverage Status

Coverage decreased (-0.02%) to 57.162% when pulling 6fc7b9e on jmdaweb:master into 12e6b34 on ryanmcgrath:master.

Copy link
Collaborator

@michaelhelmick michaelhelmick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing up your code in this new pull request. Can you adjust your code to the changes in my review? Thanks!

twython/api.py Outdated
try:
if response.status_code == 204:
content = response.content
else:
content = response.json()
except ValueError:
raise TwythonError('Response was not valid JSON. \
Unable to decode.')
if response.content!="":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this line:

if response.content != '' (spaces around operator and single quotes

twython/api.py Outdated
@@ -192,15 +196,16 @@ def _request(self, url, method='GET', params=None, api_call=None):
error_message,
error_code=response.status_code,
retry_after=response.headers.get('X-Rate-Limit-Reset'))

content=""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content = '' Space around operators and single quotes

twython/api.py Outdated
@@ -140,7 +140,11 @@ def _request(self, url, method='GET', params=None, api_call=None):
params = params or {}

func = getattr(self.client, method)
params, files = _transparent_params(params)
if type(params) is dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this if isinstance(params, dict)

@coveralls
Copy link

coveralls commented Oct 9, 2017

Coverage Status

Coverage decreased (-0.02%) to 57.162% when pulling 2cb2ed4 on jmdaweb:master into 12e6b34 on ryanmcgrath:master.

@michaelhelmick michaelhelmick merged commit 7be6541 into ryanmcgrath:master Oct 9, 2017
@michaelhelmick
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants