I’m trying to use sentinelhub package on jupyterlab notebook and for some reason I don’t manage to be able to acess images.
When I use my credentials in the configuration at the beginning it works and pronts the configuration file location, but when I try to acess images as descrribed here I get error message:
DownloadFailedException: Failed to download from: long link of
sentinel-hub with HTTPError: 404 Client Error: Not Found for url another long link of sentinelhub
Server response: “Invalid UUID string: my credentials”
This is how I have tried to acess the images:
!sentinelhub.config --instance_id MySecretCredentials
!sentinelhub.config --show
#that works, print the configurations
from sentinelhub import WebFeatureService, BBox, CRS, DataCollection, SHConfig
INSTANCE_ID = '' # I have already put instance ID into configuration file at the beginning so left it empty as required
if INSTANCE_ID:
config = SHConfig()
config.instance_id = INSTANCE_ID
else:
config = None
search_bbox = BBox(bbox=[46.16, -16.15, 46.51, -15.58], crs=CRS.WGS84)
search_time_interval = ('2017-12-01T00:00:00', '2017-12-15T23:59:59')
wfs_iterator = WebFeatureService(
search_bbox,
search_time_interval,
data_collection=DataCollection.SENTINEL2_L1C,
maxcc=1.0,
config=config
)
for tile_info in wfs_iterator:
print(tile_info)
From the code that you posted, it seems that you are specifying your INSTANCE_ID to be an empty string, which would then trigger your config variable to be None.
If when you print sentinelhub.config it is correctly setup, then you can just delete this part:
INSTANCE_ID = '' # I have already put instance ID into configuration file at the beginning so left it empty as required
if INSTANCE_ID:
config = SHConfig()
config.instance_id = INSTANCE_ID
else:
config = None
and write the following:
config = SHConfig()
To check if the credentiials are correctly assigned, you can also add:
Thank you for your answer, I have tried to do that but I still get the same error. It prints the configuration correctly but then I get again the error of “Failed to download from…”
I have tried all the versions (the id from dashboard+ client_Secret, the instance_id and the client_secret) but all creates the same error again and again.
Edit: I have managed to run the sentinelhub.config with the credentials as string and the cluent secret a string as well but again the same error in acessing images.
With xxxxx your client ID, and yyyyy your client secret (only appears once so make sure you note it!). You can generate other client ID / secret pairs otherwise.