I’ve recently created another thread that is more related to seeking out for some general guidance on building a web application around TTN:
This thread is more related to Python ↔ Swagger interaction. I would like to send a Curl GET request to the swagger and show the body, I’m using following tool to convert the Curl get request syntax provided by the swagger page: https://curl.trillworks.com/
and following python code:
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'key ttn-account-notsharinganything',
}
params = (
('last', '1h'),
)
response = requests.get('https://notsharinganything.data.thethingsnetwork.org/api/v2/query/heltec2', headers=headers, params=params)
print(response)
#NB. Original query string below. It seems impossible to parse and
#reproduce query strings 100% accurately so the one below is given
#in case the reproduced version is not "correct".
# response = requests.get('https://notsharinganything.data.thethingsnetwork.org/api/v2/query/heltec2?last=1h', headers=headers)
I just receive 200 as response, which means that I can authenticate with the swagger. However, I would like to display the ‘body content’ and not the ‘response code’.
Exact output: <Response [200]>
@descartes : thank you, that worked. It fails like a little fail, I couldn’t find that in the documentation but I could have screened what methods/variables are stored in response in my IDE.
Do you know where I can find the documentation on that?