Skip to content

Commit

Permalink
Add timeout parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMi460 committed Feb 18, 2024
1 parent 4750d19 commit f3cb6e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions nso/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from . import *

class NSOAppletAPI:
def __init__(self, *, headers:dict = None, country:str = 'US') -> None:
def __init__(self, *, headers:dict = None, country:str = 'US', timeout:int = 5) -> None:
X_Api_Token = self.authorize(headers = headers) # Set X_Api_Token

self.host = 'https://lp1.nso.nintendo.net'
Expand All @@ -21,6 +21,7 @@ def __init__(self, *, headers:dict = None, country:str = 'US') -> None:
'X-Api-Token': X_Api_Token,
})

self.timeout = timeout
cookies = self.getV1Cookies(country) # Set cookies for the future
self.expiry = cookies.expires

Expand All @@ -45,7 +46,7 @@ def _get(self, route:str, *, query:dict = {}) -> httpx.Response:

self._log('[GET]', route)

result = self.Session.get(self.host + route)
result = self.Session.get(self.host + route, timeout = self.timeout)
self._log('[GET]', route, '<Response Code [%s]>' % result.status_code)
return result

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name = 'nso-applet-api',
version = '0.0.30',
version = '0.0.31',
description = 'Nintendo NSO Applet API',
long_description = long_description,
long_description_content_type = 'text/markdown',
Expand Down

0 comments on commit f3cb6e5

Please sign in to comment.