401 Unauthorized Error - Python
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:
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:
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!
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"
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)
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/
https://requests.readthedocs.io/en/late ... ntication/
Gotcha, I added the auth and it all clicked into place. Thanks!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/
Who is online
Users browsing this forum: No registered users and 6 guests