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

Unicode Encoding Issue with Authentication Credentials #613

Open
KanHub02 opened this issue Mar 4, 2024 · 0 comments
Open

Unicode Encoding Issue with Authentication Credentials #613

KanHub02 opened this issue Mar 4, 2024 · 0 comments

Comments

@KanHub02
Copy link

KanHub02 commented Mar 4, 2024

When using the sentinelsat library to connect to the Copernicus Open Access Hub, a UnicodeEncodeError occurs during authentication if the password contains characters outside the Latin-1 (ISO-8859-1) range. This issue stems from the underlying requests library attempting to encode the credentials in Latin-1 when constructing the Authorization header for basic authentication.

Steps to Reproduce:

  1. Instantiate SentinelAPI with a username and password that includes characters beyond the Latin-1 range.
  2. Attempt to make a request to the API.

Expected Behavior:
Credentials should be properly handled and encoded, allowing successful authentication against the API even when the password contains characters beyond the Latin-1 range.

Actual Behavior:
Attempting to execute a request results in a UnicodeEncodeError, indicating an issue with encoding the password characters.

Possible Solution:
Manually encode the credentials in UTF-8 and then in base64, bypassing the automatic processing by the requests library. For example, modify the init method of the SentinelAPI class to directly set the Authorization header with the credentials encoded in base64.

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