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

TMDB ssl errors #13

Open
softwaredoug opened this issue Feb 1, 2016 · 2 comments
Open

TMDB ssl errors #13

softwaredoug opened this issue Feb 1, 2016 · 2 comments

Comments

@softwaredoug
Copy link
Collaborator

Running the code in Appendix A gives errors about trusting SSL on my Ubuntu 14.04 machine.

If I run the following "hello world" script:

import requests
import os

# you'll need to have an API key for TMDB
# to run these examples,
# run export TMDB_API_KEY=<YourAPIKey>
tmdb_api_key = os.environ["TMDB_API_KEY"]
tmdb_api = requests.Session()
tmdb_api.params={'api_key': tmdb_api_key}

httpResp = tmdb_api.get('https://api.themoviedb.org/3/movie/top_rated')

I recieve the error

(venv)doug@76$~/ws/relevant-search-book/ipython(ma) $ python tmdb_hello_world.py 
/home/doug/workspace/relevant-search-book/ipython/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "tmdb_hello_world.py", line 11, in <module>
    httpResp = tmdb_api.get('https://api.themoviedb.org/3/movie/top_rated')
  File "/home/doug/workspace/relevant-search-book/ipython/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 476, in get
    return self.request('GET', url, **kwargs)
  File "/home/doug/workspace/relevant-search-book/ipython/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/doug/workspace/relevant-search-book/ipython/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/doug/workspace/relevant-search-book/ipython/venv/local/lib/python2.7/site-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
@softwaredoug
Copy link
Collaborator Author

Workaround (for any book readers that encounter this in the time being) is to set verify=False in the requests calls, ie

httpResp = tmdb_api.get('https://api.themoviedb.org/3/movie/top_rated', verify=False)

This disables authentication that TMDB is who they say they are.

@softwaredoug
Copy link
Collaborator Author

I can't recreate this in an Ubuntu 14.04 VM. Must be my laptop... :-/

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

No branches or pull requests

1 participant