8 Messages
•
200 Points
Test drive question
Hello:
I am trying to connect “test-drive.collibra.com” from my python notebook using the below, code is not working. I am getting errors as shown below. Am I missing something or doing wrong?
Any help is greatly appreciated.
Code:-
owl = “https://”
url = “https:///auth/signin”
payload = json.dumps({
“username”: “”, # Edit Here
“password”: “”, # Edit Here
“iss”: “public” # Edit Here
})
headers = {
‘Content-Type’: ‘application/json’
}
response = requests.request(“POST”, url, headers=headers, data=payload, verify=False)
owl_header = {‘Authorization’: 'Bearer ’ + response.json()[‘token’]}
ERROR:-
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[19], line 19
15 headers = {
16 ‘Content-Type’: ‘application/json’
17 }
18 response = requests.request(“POST”, url, headers=headers, data=payload, verify=False)
—> 19 owl_header = {‘Authorization’: 'Bearer ’ + response.json()[‘token’]}
File ~/.local/lib/python3.10/site-packages/requests/models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
–> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
aaditya2000
8 Messages
•
200 Points
2 years ago
I was able to resolve this issue.
https://developer.collibra.com/tutorials/rest-api-authentication
0