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

Add JSON filter to upload, replace, upload_picture and upload_texttrack methods. #102

Merged
merged 2 commits into from
Jun 23, 2017

Conversation

etienned
Copy link
Contributor

These changes will help avoid hitting the rate limit. It's possible to specified other fields wanted in upload_picture and upload_textrack methods with the fields argument.

I also made a small change that make vimeo.py compatible with python 2.6 (unfortunately I currently need this, but soon that will be move to 2.7 and 3.6 :-( ).

self.UPLOAD_ENDPOINT,
data={'type': 'streaming',
'upgrade_to_1080': 'true' if upgrade_to_1080 else 'false'},
params={'fields': 'upload_link,complete_uri'})
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be preferable if these weren't passed in as defaults. The default library behavior always should be to pull everything back from a resource, and then if you want to slim down your payload, you can supply a list of the only fields you want.

Maybe an just add a new fields parameter to these upload and upload_picture methods, similar to how you did with upload_texttrack (just without hardcoding a set of base fields).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For upload and replace I don't see the purpose of getting all the fields by default and adding a fields parameter because ticket it's not return by the method anyway, so this data can't be use.

For upload_picture and upload_texttrack I can probably change them to return everything by default (when fields=None) to keep the default library behavior but my motivation was getting the most optimize behavior by default and preventing that developers need to dig in the code to find the minimal fields needed. To keep this last goal what I propose is to return everything when fields=None and when some fields or an empty string or list is specified, the minimal fields needed will be added to the list if they're not there.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Talked it over with the rest of the team, and it's okay. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great!

@erunion erunion merged commit b5aa465 into vimeo:master Jun 23, 2017
@erunion
Copy link
Contributor

erunion commented Jun 23, 2017

Tagged this to 0.3.10. 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.

2 participants