Skip to content

Commit 20deff4

Browse files
committed
style fixes
1 parent f3a7f70 commit 20deff4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

inventree/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import requests
1414
from requests.auth import HTTPBasicAuth
1515
from requests.exceptions import Timeout
16+
1617
from . import oAuthClient as oauth
1718

1819
logger = logging.getLogger('inventree')
@@ -291,7 +292,6 @@ def requestOidcToken(self):
291292

292293
return self.token
293294

294-
295295
def request(self, api_url, **kwargs):
296296
""" Perform a URL request to the Inventree API """
297297

inventree/oAuthClient.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
import os
2+
import urllib.parse as urlparse
3+
import webbrowser
24
from http.server import BaseHTTPRequestHandler, HTTPServer
5+
36
from requests_oauthlib import OAuth2Session
4-
import webbrowser
5-
import urllib.parse as urlparse
67

78
# Environment setup
89
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
910
USABLE_PORT_RANGE = (29170, 292180)
1011

1112

1213
class OAuthClient:
13-
def __init__(self, server_url: str = "http://localhost:8000", client_id: str ='', scopes: list = None) -> None:
14+
def __init__(self, server_url: str = "http://localhost:8000", client_id: str = '', scopes: list = None) -> None:
1415
self.server_url = server_url
1516
self.client_id = client_id
1617
self.scopes = scopes if scopes is not None else []
1718

1819
self._handler_wrapper = RequestHandlerWrapper(self)
1920
self._setup_callback()
2021
self._poll_user()
21-
22+
2223
def get_url(self, path: str) -> str:
2324
"""Get the authorization URL."""
2425
return urlparse.urljoin(self.server_url, path)
@@ -53,7 +54,7 @@ def callback(self, callback_url: str):
5354

5455

5556
class RequestHandlerWrapper:
56-
"""Provides callback for OIDC endpint."""
57+
"""Provides callback for OIDC endpoint."""
5758
def __init__(self, oauth_client) -> None:
5859
self.done = False
5960
self.error = None
@@ -97,6 +98,7 @@ def log_message(self, *args):
9798

9899
return RequestHandler
99100

101+
100102
class OAuthError(Exception):
101103
"""Exception raised during the OAuth process."""
102104
def __init__(self, message: str) -> None:

0 commit comments

Comments
 (0)