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

Modify get params to use api_key defined in params #85

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

harshulsahni
Copy link

the _get_params function only relied on tmdb.API_KEY = ... to set an API key. This PR aims to add functionality so that the user can specify an API key in every function to eliminate this global dependency.

See the test test_tmdb_get_params_no_api_with_search in test_base.py for example usage.

Also, this PR simplifies some boolean and string logic to for conciseness.

tmdb.API_KEY = None
with self.assertRaises(tmdb.base.APIKeyError):
tmdb_no_api_defined._get_params(params={})
tmdb.API_KEY = API_KEY
Copy link
Author

Choose a reason for hiding this comment

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

everytime I change the API_KEY to None, I "reset" it like so to preserve the other tests

@celiao
Copy link
Owner

celiao commented Jan 25, 2022

@harshulsahni Why do you want to use more than one API Key?

@harshulsahni
Copy link
Author

@celiao I don't want to use more than one API key, but rather I would like the endpoint functions (e.g. search.movie()) to be used without having to define the API key at the top of some file. It would be much cleaner (in my opinion) to have the API key defined in the arguments of these functions so they can be more modular.

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