Python Api - Unable to Parse
I have a Python script that uses the latest sumologic-sdk (v 0.1.11) but it fails on queries that contain a '?' in the query.
eg: '/foo/bar?'
File "/usr/local/lib/python3.7/site-packages/sumologic/sumologic.py", line 117, in search_job
r = self.post('/search/jobs', params)
File "/usr/local/lib/python3.7/site-packages/sumologic/sumologic.py", line 73, in post
r.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: {
"status" : 400,
"id" : "OBA27-LFFI4-Z6I7Q",
"code" : "searchjob.parse.error",
"message" : "Unable to parse query."
} for url: https://api.sumologic.com/api/v1/search/jobs
This works in the UI and I thought any UI query could be used in the python API, is there some escaping that needs to be done?
Changing the query to just '/foo/bar' works as expected, but returns results I don't want to have to filter locally.
The inputs to the to SDK call are for example:
sumologic.py -
def search_job(self, query, fromTime=None, toTime=None, timeZone='UTC', byReceiptTime=None):
params = {dict} <class 'dict'>: {'query': '/foo/bar/api?', 'from': '2020-09-18T12:00:00', 'to': '2020-09-18T15:00:00', 'timeZone': 'PST', 'byReceiptTime': True}
'query' (4483546928) = {str} '/foo/bar/api?'
'from' (4480816816) = {str} '2020-09-18T12:00:00'
'to' (4481221808) = {str} '2020-09-18T15:00:00'
'timeZone' (4497411760) = {str} 'PST'
'byReceiptTime' (4497411824) = {bool} True
__len__ = {int} 5
-
Official comment
Hi Scott,
Sorry for the delayed response.
I think you have it figured that it relates to the question mark. I would try to escape the question mark with a backslash to see if it helps. I believe the query was as follows
patient-domain/api/appointment?
If this is still an issue, please feel free to open a ticket by going in the UI to Help -> Support
Best Regards
Raghu
Comment actions
Please sign in to leave a comment.
Comments
1 comment