0

I'm trying to get access to the BambooHR API (documentation here), but I receive the following error

    params = {
        'user': username,
        'password': password,
        'api_token': api_key}
    url = 'https://api.bamboohr.com/api/gateway.php/company/v1/login'
    r = requests.get(url, params=params)

Error:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1580, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 964, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Users/chriscruz/Dropbox/PycharmProjects/082716_r2/Shippy/API/bamboo_api2.py", line 31, in <module>
    BambooFunctions().login()
  File "/Users/chriscruz/Dropbox/PycharmProjects/082716_r2/Shippy/API/bamboo_api2.py", line 26, in login
    r = requests.get(url, params=params, auth=HTTPBasicAuth(api_key, 'api_token'))
  File "/Library/Python/2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: Error([('SSL routines', 'SSL23_GET_SERVER_HELLO', 'unknown protocol')],)",)

I'm unsure what this is caused by as I've re-installed OpenSSL, Requests, and not sure how to fix this issue.

Chris
  • 5,444
  • 16
  • 63
  • 119
  • Does installing `requests[security]` package help? – alecxe Oct 12 '16 at 17:31
  • Are you sure, you are connecting to secure port on the server. I do see the "https" url. The error usually is seen when you connect to a non secure port and server sends in some data (which is not server-hello) – Prabhu Oct 12 '16 at 17:57

1 Answers1

0

You try by setting verify=False, use this option if you are using self-signed certificates.

r = requests.get(url, params=params, verify=False)

More info http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification

Vividh S V
  • 131
  • 1
  • 7