This function is taken from the examples slightly modified:
def getAuthenticationToken(self, userName, password): authReqUrl = self.baseUrl + "Authentication/RequestToken" credentialsData = {'Credentials': {'Username': userName, 'Password': password}} r = requests.post(url=authReqUrl, json=credentialsData, headers=self.requestHeaders) if (r.status_code == 200): jsonResponse = json.loads(r.text.encode('ascii', 'ignore')) token = {'timestamp': datetime.datetime.now(), 'token': jsonResponse["value"]} with open('TRTH_token.pkl', 'wb') as handle: pickle.dump(token, handle, protocol=pickle.HIGHEST_PROTOCOL) return token else: print("ERROR: could not retrieve authentication token, check username and password:") print("Status code: ", r.status_code, "\nResponse:\n", r.text) sys.exit()
This returns the following response:
Status code: 401 Response: {"error":{"message":"Invalid username or password"}}
The username and passwords sent as args are the ones corresponding to this website. I tried using both email and username, but neither work. Eventually, this is what I'm looking for; a simple mapping which requires authentication, therefore this question.
Thanks!