Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyracing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


class Client:
def __init__(self, username: str, password: str):
def __init__(self, username: str, password: str, timeout=10.0):
""" This class is used to interact with all iRacing endpoints that
have been discovered so far. After creating an instance of Client
it is required to call authenticate(), due to async limitations.
Expand All @@ -43,6 +43,7 @@ def __init__(self, username: str, password: str):
"""
self.username = username
self.password = encode_password(username,password)
self.timeout = timeout
self.session = httpx.AsyncClient()

def _rename_numerical_keys(self, response_item, mapping):
Expand Down Expand Up @@ -109,7 +110,7 @@ async def _build_request(self, url, params):
url,
params=params,
allow_redirects=False,
timeout=10.0
timeout=self.timeout
)
logger.info(f'Request sent for URL: {response.url}')
logger.info(f'Status code of response: {response.status_code}')
Expand Down
1 change: 1 addition & 0 deletions pyracing/response_objects/session_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, data):
self.car_color_2 = data['car_color2']
self.car_color_3 = data['car_color3']
self.car_id = data['carid']
self.car_name = parse_encode(data['car_name'])
self.car_num = data['carnum']
self.car_num_font = data['carnumberfont']
self.car_num_slant = data['carnumberslant']
Expand Down