sumologic-python-sdk
sumologic-python-sdk copied to clipboard
Jobs Message API return 401
Hi Team
sumo = SumoLogic(ACCESS_ID, ACCESS_KEY)
response = sumo.search_job(query, from_v, to, timeZone, True, autoParsingMode='Manual')
After calling the sumo.search_job_messages(response,8)
I am getting the below error though I am getting the job_id
from search_job
raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: { "status" : 400, "id" : "2U5U6-YAO5P-DOFTB", "code" : "searchjob.generic", "message" : "Generic error." } for url: https://api.sumologic.com/api/v1/search/jobs/job_id/messages?limit=8&offset=0
I was trying with the below option:
auth = (ACCESS_ID, ACCESS_KEY)
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
}
results_url = f'https://api.sumologic.com/api/v1/search/jobs/{response['id']}/messages'
resp = requests.get(results_url, auth=auth, headers=headers)
I am getting 401 error code.
How to solve this?