Skip to content

Commit 7f720bb

Browse files
Juliana MashonJuliana Mashon
Juliana Mashon
authored and
Juliana Mashon
committed
Cleaned up--working
1 parent 5094ad9 commit 7f720bb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

functions/authentication.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ def get_token(self, email, password, server="https://my.farm.bot"):
4040
response = requests.post(f'{server}/api/tokens', headers=headers, json=user)
4141
# Handle HTTP status codes
4242
if response.status_code == 200:
43-
token_data = response.json()
44-
self.state.token = token_data # TODO: simplify?
43+
self.state.token = response.json()
4544
self.state.error = None
46-
return token_data
45+
return response.json()
4746
elif response.status_code == 404:
4847
self.state.error = "HTTP ERROR: The server address does not exist."
4948
elif response.status_code == 422:
@@ -87,7 +86,6 @@ def request(self, method, endpoint, database_id, payload=None):
8786

8887
if self.request_handling(response) == 200:
8988
self.state.error = None
90-
request_data = response.json()
91-
return request_data
89+
return response.json()
9290
else:
9391
return self.state.error

0 commit comments

Comments
 (0)