Skip to content

TMDB ssl errors #13

@softwaredoug

Description

@softwaredoug

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions