added media_category and support for STATUS calls #428

Merged
tushdante merged 4 commits from tushdante-video-upload into master 2016-09-30 04:28:38 -07:00
Showing only changes of commit 2c02b622a2 - Show all commits

View file

@ -199,7 +199,28 @@ class EndpointsMixin(object):
'command': 'FINALIZE',
michaelhelmick commented 2016-09-23 06:20:52 -07:00 (Migrated from github.com)

Can you change these double quotes to single quotes, please?

Can you change these double quotes to single quotes, please?
michaelhelmick commented 2016-09-23 06:21:22 -07:00 (Migrated from github.com)

You don't need to default to None as check_after_secs = response_finalize['processing_info'].get('check_after_secs') will return None if it doesn't exist

You don't need to default to `None` as `check_after_secs = response_finalize['processing_info'].get('check_after_secs')` will return `None` if it doesn't exist
michaelhelmick commented 2016-09-23 06:21:37 -07:00 (Migrated from github.com)

You don't need to default to None as processing_state = response_finalize['processing_info'].get('state') will return None if it doesn't exist

You don't need to default to `None` as `processing_state = response_finalize['processing_info'].get('state')` will return `None` if it doesn't exist
michaelhelmick commented 2016-09-26 05:32:34 -07:00 (Migrated from github.com)

Can you just make this if check_progress -- sorry, a lot of the review is just styling issues!

Can you just make this `if check_progress` -- sorry, a lot of the review is just styling issues!
michaelhelmick commented 2016-09-26 05:35:28 -07:00 (Migrated from github.com)

Can you make this:

response = self.post(upload_url, params=params)

outside of this if check_progress:

and use response everywhere you use response_finalize

and outside of the check, you can just return response then, does that make sense or should I elaborate more?

Can you make this: ``` python response = self.post(upload_url, params=params) ``` outside of this `if check_progress:` and use `response` everywhere you use `response_finalize` and outside of the check, you can just `return response` then, does that make sense or should I elaborate more?
tushdante commented 2016-09-26 12:43:49 -07:00 (Migrated from github.com)

No worries! @michaelhelmick totally happy to ensure everything is compliant. appreciate the feedback!

No worries! @michaelhelmick totally happy to ensure everything is compliant. appreciate the feedback!
'media_id': media_id
}
return self.post(upload_url, params=params)
response_finalize = self.post(upload_url, params=params)
# Stage 4: STATUS call if still processing
params = {
'command': 'STATUS',
'media_id': media_id
}
processing_state = response_finalize['processing_info'].get('state', None)
if processing_state is not None:
while (processing_state == "pending" or processing_state == "in_progress") :
# get the secs to wait
check_after_secs = response_finalize['processing_info'].get('check_after_secs', None)
if check_after_secs is not None:
time.sleep(check_after_secs)
response_finalize = self.get(upload_url, params=params)
# get new state after waiting
processing_state = response_finalize['processing_info'].get('state')
return response_finalize
def get_oembed_tweet(self, **params):
"""Returns information allowing the creation of an embedded