ncssar / sartopo_python

Python calls for the caltopo / sartopo API
GNU General Public License v3.0
14 stars 2 forks source link

signed GET requests #60

Closed caver456 closed 4 months ago

caver456 commented 5 months ago

Additional info just received: GET requests for secret maps must be signed (this part might always have been the case); team maps are now secret by default; and new throttling / speedbumps have been introduced. So: creating a new issue for signed GET requests, which will also enable the fixing of #50 and #48.

From comments in #50:

caver456 commented on Feb 17, 2023 Resolved this 401 mystery with the help of Matt J and Steve K.

basically: send a signed GET request to https://sartopo.com/api/v1/acct//since/0 with json=’’

The discovery that was holding up progress for months was: In the data to be hashed, make sure you include the newline after the expires timestamp string. The hashed data must have a newline after the URL tail, and another newline after the expires timestamp.

That realization should clear the logjam for this issue and for https://github.com/ncssar/sartopo_python/issues/48.

caver456 commented 4 months ago

Had some stumbling points in the last month, trying to reproduce the successful results of early 2023. Got it up and running again with help from the caltopo author, noting that the GET request params need to be url encoded on the query string, rather than sent in the request body. So the only real problem was that I was using the 'data' argument, which passes the dict in the request body, instead of the 'params' argument, which passes the dict on the URL query string. Changing from 'data' to 'params' fixed things.

caver456 commented 4 months ago

testing with all request types looks good (and fails on a secret map, as expected, when removing the signature args); sending to Steve for testing with plans_console etc

caver456 commented 4 months ago

Steve confirms this is ready to merge.