From 7504968488d3fee4c80c4b3fb5d795a043b6f9c8 Mon Sep 17 00:00:00 2001 From: Antoine DESRUET Date: Tue, 28 Jun 2022 09:43:26 +0200 Subject: [PATCH] refactor: set cookies after status code check --- setup.py | 2 +- src/CVAT/__init__.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 41c535a..7497e06 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="CVAT wrapper", - version="0.0.18", + version="1.0.0", author="antwxne", author_email="antoine.desruet@epitech.eu", description="Python wrapper for CVAT API", diff --git a/src/CVAT/__init__.py b/src/CVAT/__init__.py index cea4a1d..840fc2c 100644 --- a/src/CVAT/__init__.py +++ b/src/CVAT/__init__.py @@ -34,8 +34,6 @@ def __init__(self, username: str = "admin", password: str = "admin", url: str = } response: Response = self.session.post(url=f'{self.url}/api/auth/login', json=body) - self.session.headers = {"Authorization": f'Token {response.json()["key"]}'} if response.status_code != 200: raise ValueError("Bad credentials") - - + self.session.headers = {"Authorization": f'Token {response.json()["key"]}'}