eodms-sgdot / py-eodms-rapi

EODMS RAPI Client is a Python3 package used to access the REST API service provided by the Earth Observation Data Management System (EODMS) from Natural Resources Canada.
Other
13 stars 4 forks source link

authentication error (intermittent) #33

Closed djbeaulne closed 2 months ago

djbeaulne commented 1 year ago

Intermittent authentication error when querying through EODMSRAPI.

By intermittent, I mean that a few weeks ago, I was getting an authentication error. I set it aside, did other work, but didn't change anything with regards to my computer system, installations, or EODMS account. Yesterday my query worked, but today I am getting an authentication error again. Sometimes the authentication error is preceded by timeouts; in this instance, it is not.

Throughout this, I have always been able to log in to 'the actual website, https://www.eodms-sgdot.nrcan-rncan.gc.ca/index-en.html', using the same credentials I use through EODMSRAPI, which is provided in the error message.

Occurs for all collections; 'Radarsat2RawProducts', 'Radarsat2', 'Radarsat1', and 'RCMImageProducts' are the ones I'm most interested in.

A screenshot of error messages and my roi .geojson file are attached.

This might be a separate issue, and it's something that I can work around, but - if a query fails, and I try to re-submit the query, i.e. two sequential rapi.search() queries, with a failed first attempt, no error message is provided after the second attempt. I have to re-login using rapi=EODMSRAPI(user,pass) after a failed rapi.serach() attempt in order for the new search to be sent through. This is demonstrated in the third rapi.search() attempt in the screenshot.

image

geojson file:

{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -83.477629563048367, 42.904063909639284 ], [ -81.0, 42.904063909639284 ], [ -81.0, 41.382130631893006 ], [ -83.477629563048367, 41.382130631893006 ], [ -83.477629563048367, 42.904063909639284 ] ] ] } } ] }

willmacs commented 2 months ago

Hi @djbeaulne, the intermittent nature of your authentication is likely because RCMImageProducts can be search both authenticated and non-authenticated, whereas Radarsat2 always requires authentication. We invite you to use the eodms-cli which abstracts all this from the user. If you wish to integrate EODMS search into your workflow, then py-rapi-api is the way to go, but you will need to be sure to re-authenticate every 30 minutes to ensure your HTTP sessions is in good standing, since there the server will auto-log you out