Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4049

MicroPython • Re: Will I be able to run this code on MicroPython?

$
0
0
Hippy
I've tried your code and progressed but I don't think I fully understand what I need to send in the GET request
This is the output from your code replacing the URL with my metoffice one. I've not put my SECRET api code in for obvious reasons so you won't be able to run it. But the rest of the headers and params are correct and match the original request.get().

ESP32 : Connecting to router
Connected
XX.XXX.207.47
URL = 'data.hub.api.metoffice.gov.uk/sitespecific/v0/point/'
HOST = 'data.hub.api.metoffice.gov.uk' URL = '/sitespecific/v0/point/'
Sending request ...
>> GET /sitespecific/v0/point/ HTTP/1.1
>> Host: data.hub.api.metoffice.gov.uk
>> headers : 'apikey': 'SECRET==', 'accept': 'application/json'
>> params : 'includeLocationName': True, 'latitude': 52.2333, 'longitude': -2.3667, 'excludeParameterMetadata': False
>>
Receiving reply ...
<< HTTP/1.1 301 Moved Permanently
<< Server: awselb/2.0
<< Date: Sun, 11 Feb 2024 12:35:59 GMT
<< Content-Type: text/html
<< Content-Length: 134
<< Connection: keep-alive
<< Location: https://data.hub.api.metoffice.gov.uk:4 ... /v0/point/
<<
<< <html>
<< <head><title>301 Moved Permanently</title></head>
<< <body>
<< <center><h1>301 Moved Permanently</h1></center>
<< </body>
<< </html>

Statistics: Posted by MarkDH102 — Sun Feb 11, 2024 12:42 pm



Viewing all articles
Browse latest Browse all 4049

Trending Articles