Skip to main content

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=o46.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)

what do I do wrong?

Hi,

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:

print(config)

 


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…”


First thing: make sure that when you set your INSTANCE_ID


!sentinelhub.config --instance_id MySecretCredentials

you are actually setting the Instance ID string: example in FAQ from your Configuration Utility.


Furthermore, when you setup your credentials, please make sure to set your Client ID and Client Secret also:


!sentinelhub.config --sh_client_id <your client id> --sh_client_secret <your client secret>

You can generate a client ID and Secret in your User Setting page, under OAuth clients (with the green + button):



thank you for the answer, i’m still a little but confused, if I understand correct, there is client_id, instance_id and secret.


I have managed to see the client_id and the client_secret on the dashbord, though when I run:


!sentinelhub.config --sh_client_id --sh_client_secret


I get the same error.


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.




reutkeller:


!sentinelhub.config --sh_client_id --sh_client_secret



Just to clarify (in case you did so but hid the information for the forum): it should be:


!sentinelhub.config --sh_client_id "xxxxxx" --sh_client_secret "yyyyyy"

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.


Thank you very much for your help


Reply