401 Unauthorized Error - Python

Talk about whatever

3 posts • Page 1 of 1

Postby banjodole » Thu Jan 19, 2023 12:25 am

Hello!
I am trying to do a basic query in python and have been having issues. I assume I'm pretty close but I'm currently getting the error 401 - Not Unauthorized (WiGLE.net).

To test it initially, I created an example in the API section and it gave me this output:

Code: Select all

curl -X GET "https://api.wigle.net/api/v2/network/search?onlymine=false&latrange1=37.084543200000005&latrange2=37.884543200000005&longrange1=-122.5493071&longrange2=-121.7493071&lastupdt=20190101&freenet=false&paynet=false" -H "accept: application/json" -H "authorization: Basic INSERT BASIC AUTH CODE HERE"
This code worked just fine when I tested it, which makes sense.

I tried to move it to python but I'm getting that "Not Authorized" error:

Code: Select all

header1={ "accept":"application/json", "authorization":"Basic INSERT BASIC AUTH CODE HERE" }] url = 'https://api.wigle.net/api/v2/network/search?onlymine=false&latrange1=37.084543200000005&latrange2=37.884543200000005&longrange1=-122.5493071&longrange2=-121.7493071&lastupdt=20190101&freenet=false&paynet=false' wigle_data = requests.get(url, headers=header1)
All signs point to an implementation issue on my end. I'm not great at HTML/GET/POST stuff so I'm likely setting something up wrong but the random examples I've looked at seem to suggest this should work. Am I missing something obvious? Any help you can give me would be appreciated. Thanks!

Postby arkasha » Thu Jan 19, 2023 3:59 am

can't tell what you put in your header value from that sample, but don't roll your own auth.

https://requests.readthedocs.io/en/late ... ntication/

Postby banjodole » Thu Jan 19, 2023 10:23 pm

can't tell what you put in your header value from that sample, but don't roll your own auth.

https://requests.readthedocs.io/en/late ... ntication/
Gotcha, I added the auth and it all clicked into place. Thanks!

3 posts • Page 1 of 1

Return to “General Grabbag”

Who is online

Users browsing this forum: Google [Bot] and 36 guests