I have the following code in locust.io
def login(self):
response = self.client.get("/oauth/app", headers={"grant_type":"authorization_code", "response_type":"code", "client_id":"tas_app_test","client_secret":"tas_app_test_secret", "redirect_uri":self.host+"/client/tasapp/login","scope":"tas_app"})
print(dict(response.cookies))
and it gives a nice output in the console
{'_csrf': '1ujFp4istcAw-p8WNc_gfO9k', 'tasIdentityCookieTAS': 's%3AwulD_7i2oFnZCNAWIHxFtN8TIcvvlUWV.ygnH1r9WAGwt2fNvJmcKqndogP9bjahVn1r0Jbna954'}
but when I change the print line to print(response.cookies['tasIdentityCookieTAS'])
i get the following error
[2020-10-21 17:00:26,613] SGJURM00250/ERROR/locust.user.task: "name='tasIdentityCookieTAS', domain=None, path=None"
Traceback (most recent call last):
File "c:\users\liaoga\appdata\local\programs\python\python38-32\lib\site-packages\locust\user\task.py", line 290, in run
self.execute_next_task()
File "c:\users\liaoga\appdata\local\programs\python\python38-32\lib\site-packages\locust\user\task.py", line 315, in execute_next_task
self.execute_task(self._task_queue.pop(0))
File "c:\users\liaoga\appdata\local\programs\python\python38-32\lib\site-packages\locust\user\task.py", line 424, in execute_task
task(self.user)
File "C:\Users\liaoga\source\repos\masterserver\locustfile.py", line 37, in login
print(response.cookies['tasIdentityCookieTAS'])
File "c:\users\liaoga\appdata\local\programs\python\python38-32\lib\site-packages\requests\cookies.py", line 328, in __getitem__
return self._find_no_duplicates(name)
File "c:\users\liaoga\appdata\local\programs\python\python38-32\lib\site-packages\requests\cookies.py", line 399, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='tasIdentityCookieTAS', domain=None, path=None"
What could be the issue?