Dear all,
I have tried to do the authentification in Python using the tutorial https://docs.sentinel-hub.com/api/latest/api/overview/authentication/#python to download third party satellite images (e.g SPOT).
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
Your client credentials
client_id=“my_client_ID’”
client_secret="my_secret_id’
Create a session
client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
Get token for the session
However, when I try to get the token for my session using
token = oauth.fetch_token(token_url=‘https://services.sentinel-hub.com/oauth/token’,
client_id=client_id, client_secret=client_secret)
I have the following error :
UnicodeEncodeError: ‘latin-1’ codec can’t encode characters in position 3-7: ordinal not in range(256)
It seems that it comres from the fact that my client_secret has characters like {,^,#,$ which cannot be decoded in latin-1.
You can reproduce the error using client_secret.encode(‘iso-8859-1’).decode(‘latin-1’)
How can I fix this?
Thanks a lot,
Johann