Am trying for days to pull some date from influxDB and am getting the below missing parameter "q" with 400 error or if i change something in the parameters am getting 404 error on the response if anyone faced the same issue on the past or someone to help to understand how can i resolve this issue?
url='https://<hostname>8086/query'
values=[]
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
params = {
'db': 'tail_screw_20',
}
data = 'q=select time, "RH(%)", "T(C)" from PM_histo WHERE time >= \'2022-05-04T11:00:00Z\'
and time <= \'2022-05-04T11:10:00Z\' order by time asc'
response = requests.get(url=url, params=params, headers=headers,verify=False,data=data)
print(response.text)
print(response)
Error:
{"error":"missing required parameter "q""} <Response [400]>
CodePudding user response:
this issue usually is related to a problem to the parameter you pass with data=data.
Please check the data variable, should it be a tuple/ditctionary? https://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests
CodePudding user response:
You can try with the influxDb python library