Modify get params to use api_key defined in params#85
Conversation
Add line to fix tests
…e into modify_get_params
| tmdb.API_KEY = None | ||
| with self.assertRaises(tmdb.base.APIKeyError): | ||
| tmdb_no_api_defined._get_params(params={}) | ||
| tmdb.API_KEY = API_KEY |
There was a problem hiding this comment.
everytime I change the API_KEY to None, I "reset" it like so to preserve the other tests
|
@harshulsahni Why do you want to use more than one API Key? |
|
@celiao I don't want to use more than one API key, but rather I would like the endpoint functions (e.g. |
|
Thank you @harshulsahni for the contribution and the thoughtful implementation! The code itself is clean and the tests are thorough. After consideration, we're going to keep authentication simple — the global For the rare multi-tenant use case, users can always save and restore the global key around their calls. Closing for now, but genuinely appreciate your suggestion and PR! |
the
_get_paramsfunction only relied ontmdb.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_searchintest_base.pyfor example usage.Also, this PR simplifies some boolean and string logic to for conciseness.