Skip to content

Commit ae1e292

Browse files
committed
deepsource fixes
1 parent 351a5d7 commit ae1e292

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

fennel_invest_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from fennel_invest_api.endpoints import Endpoints
22
from fennel_invest_api.fennel import Fennel
33

4-
__all__ = ["Endpoints", "Fennel"]
4+
__all__ = ["Endpoints", "Fennel"]

fennel_invest_api/endpoints.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ def retrieve_bearer_url(self):
1313
def oauth_url(self):
1414
return f"{self.accounts}/oauth/token"
1515

16-
def build_graphql_payload(self, query, variables={}):
16+
def build_graphql_payload(self, query, variables=None):
17+
if variables is None:
18+
variables = {}
1719
return {
1820
"operationName": None,
1921
"variables": variables,

fennel_invest_api/fennel.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def login(self, email, wait_for_code=True, code=None):
6969
if self.Bearer is not None:
7070
if self._verify_login():
7171
return True
72-
else:
73-
self._clear_credentials()
72+
self._clear_credentials()
7473
if code is None:
7574
url = self.endpoints.retrieve_bearer_url()
7675
payload = {
@@ -103,7 +102,6 @@ def login(self, email, wait_for_code=True, code=None):
103102
self.Bearer = response['access_token']
104103
self.Refresh = response['refresh_token']
105104
self.ID_Token = response['id_token']
106-
# refresh_token() # Refresh token after login?
107105
self._save_credentials()
108106
return True
109107

@@ -129,12 +127,12 @@ def _verify_login(self):
129127
try:
130128
self.get_portfolio_summary()
131129
return True
132-
except Exception as e:
130+
except Exception:
133131
self.refresh_token()
134132
try:
135133
self.get_portfolio_summary()
136134
return True
137-
except Exception as e:
135+
except Exception:
138136
return False
139137

140138
@check_login
@@ -186,4 +184,4 @@ def place_order(self, ticker, quantity, side, price="market"):
186184
order_response = self.session.post(self.endpoints.graphql, headers=headers, data=query)
187185
if order_response.status_code != 200:
188186
raise Exception(f"Order Request failed with status code {order_response.status_code}: {order_response.text}")
189-
return order_response.json()
187+
return order_response.json()

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
author="Nelson Dane",
1111
packages=["fennel_invest_api"],
1212
install_requires=["requests", "python-dotenv"],
13-
)
13+
)

0 commit comments

Comments
 (0)