Westonci.ca is the premier destination for reliable answers to your questions, provided by a community of experts. Discover solutions to your questions from experienced professionals across multiple fields on our comprehensive Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

I'm trying to update some python code, but I'm getting an error message. Previously with the v8 api from toggl this would give me a 410 error because the URL doesnt exist.
I updated only the URL and when running get
**
(autotoggl2) c:\autotoggl2>autotoggl1.5.py
Traceback (most recent call last):
File "C:\autotoggl2\autotoggl1.5.py", line 179, in testCredentials
if '200' not in str(response):
UnboundLocalError: local variable 'response' referenced before assignment
**
def testCredentials(self):
headers = {'Content-Type': 'application/json'}
self.console_log('Testing credentials')
autht = self.widgetAuthType.currentIndex()
if autht == 0:
self.console_log('Using API Token')
else:
if autht == 1:
self.console_log('Using username/password')
else:
if autht == 0:
response = requests.get('https://api.track.toggl.com/api/v9/me', headers=headers, auth=(self.api_key.replace('\n', ''), 'api_token'))
else:
if autht == 1:
response = requests.get('https://api.track.toggl.com/api/v9/me', headers=headers, auth=(self.api_username, self.api_password))
else:
response = '400'
if '200' not in str(response):
self.console_log('FAILURE: ' + str(response))
else:
self.console_log('SUCCESS')
here is the code I'm using, and I suspect its an issue with the request format.