Sentinel Hub API throwing SSL error while calling using Python

While calling the Sentinel Hb Process API through Python its throwing an SSL error. I have Added proper Client Secret Key and ID as well.

Here is the code

import requests
from oauthlib.oauth2 import BackendApplicationClientfrom requests_oauthlib import OAuth2Session Your client credentials**
client_id = ''

client_secret = '

# Create a session

client = BackendApplicationClient(client_id=client_id)

oauth = OAuth2Session(client=client)

def sentinelhub_compliance_hook(response):
    response.raise_for_status()

    return response

oauth.register_compliance_hook("access_token_response", sentinelhub_compliance_hook)

# Get token for the session

token = oauth.fetch_token(token_url='https://services.sentinel-hub.com/oauth/token',

                          client_secret=client_secret)

# All requests using this session will have an access token automatically added

resp = oauth.get("https://services.sentinel-hub.com/oauth/tokeninfo")

print(resp.content)

Error

requests.exceptions.SSLError: HTTPSConnectionPool(host='services . sentinel-hub . com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))

Kindly help me on this.

Hi @b.ashok.amrutkar ,

According to your stack trace it seems that the main cause is:

Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))

This indicates that there is a problem with an SSL certificate on your computer. There was one user that reported the same issue a while ago but for a different Python utility. Please check our answer:
https://shforum.sinergise.com/t/slovenia-jupyter-notebook/4059/29?u=chung.horng