sharpapi 0.3.2__py3-none-any.whl → 0.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sharpapi/_base.py CHANGED
@@ -33,6 +33,15 @@ RETRY_BASE_DELAY = 0.5
33
33
  RETRY_MAX_DELAY = 4.0
34
34
 
35
35
 
36
+ def normalize_base_url(base_url: str) -> str:
37
+ """Return the API origin URL, accepting values with a trailing /api/v1."""
38
+ cleaned = base_url.rstrip("/")
39
+ suffix = "/api/v1"
40
+ if cleaned.endswith(suffix):
41
+ return cleaned[: -len(suffix)]
42
+ return cleaned
43
+
44
+
36
45
  def should_retry(response: httpx.Response | None, exc: Exception | None) -> bool:
37
46
  """True for transient upstream failures worth retrying."""
38
47
  if exc is not None:
sharpapi/async_client.py CHANGED
@@ -15,6 +15,7 @@ from ._base import (
15
15
  AuthMethod,
16
16
  handle_errors,
17
17
  make_headers,
18
+ normalize_base_url,
18
19
  parse_rate_limit,
19
20
  parse_response,
20
21
  retry_delay,
@@ -89,7 +90,7 @@ class AsyncSharpAPI:
89
90
 
90
91
  self._api_key = api_key
91
92
  self._auth_method: AuthMethod = auth_method
92
- self._base_url = base_url.rstrip("/")
93
+ self._base_url = normalize_base_url(base_url)
93
94
  self._timeout = timeout
94
95
  self._http = httpx.AsyncClient(
95
96
  base_url=f"{self._base_url}/api/v1",
sharpapi/client.py CHANGED
@@ -15,6 +15,7 @@ from ._base import (
15
15
  AuthMethod,
16
16
  handle_errors,
17
17
  make_headers,
18
+ normalize_base_url,
18
19
  parse_rate_limit,
19
20
  parse_response,
20
21
  retry_delay,
@@ -97,7 +98,7 @@ class SharpAPI:
97
98
 
98
99
  self._api_key = api_key
99
100
  self._auth_method: AuthMethod = auth_method
100
- self._base_url = base_url.rstrip("/")
101
+ self._base_url = normalize_base_url(base_url)
101
102
  self._timeout = timeout
102
103
  self._http = httpx.Client(
103
104
  base_url=f"{self._base_url}/api/v1",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sharpapi
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Official Python SDK for the SharpAPI real-time sports betting odds API
5
5
  Project-URL: Homepage, https://sharpapi.io
6
6
  Project-URL: Documentation, https://docs.sharpapi.io/sdks/python
@@ -1,13 +1,13 @@
1
1
  sharpapi/__init__.py,sha256=7m3CaUCg8wxNBihnmEsdflKCuTryceJnn-eW8zund3Y,2372
2
- sharpapi/_base.py,sha256=D47zn_qwhD3UlE0Wez7rvbEq2r21ZAnSmmoeAJ4dURA,5841
2
+ sharpapi/_base.py,sha256=mhHqv-swAB00YQLXBmYArI6QLY0r6_kMVLNkKNFArSg,6117
3
3
  sharpapi/_utils.py,sha256=nQU1gNkzepAIr93HDYX455aRO2yhc6BeBbaWDnpI5lw,1143
4
- sharpapi/async_client.py,sha256=s_lkwvOctMSEE3WkNGXiZk1ulnrkVm5LVsrkOiqsCkw,19757
5
- sharpapi/client.py,sha256=823nvQwsQ1k9vzQz5_zwXzie6FvrfAzaiqBaOcN6pss,27833
4
+ sharpapi/async_client.py,sha256=TBPvR0xGCJ-MK9tPvXiXToJ0wfXzCL9TxwGO2u6bmNo,19789
5
+ sharpapi/client.py,sha256=Ev-Ye6-vF3R8WnUIGgJ6oE1TNuTQiL7G2fd69bPcrSw,27865
6
6
  sharpapi/exceptions.py,sha256=AqZmr5ceXKyEVKdVA8ua-D0klH6zrXEMgs9Rxn7O2eE,7095
7
7
  sharpapi/models.py,sha256=TIRbb7uaW9yTAk6kKZuCSkCILqQaoYyA289N_3ettrQ,19325
8
8
  sharpapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  sharpapi/streaming.py,sha256=sSdVE9HzuiDYnYH_Lmr4NHq0CKvwbUIELJvbSdqaTCw,8940
10
- sharpapi-0.3.2.dist-info/METADATA,sha256=cFrChp78mFzbdLl3DpxzEIP_-wexOi-OCIZ7kByGz7U,5735
11
- sharpapi-0.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
12
- sharpapi-0.3.2.dist-info/licenses/LICENSE,sha256=EfZuzcYtp0eJC9ky4Nei3os5r0cFBYQmc-TpamV5OPw,1069
13
- sharpapi-0.3.2.dist-info/RECORD,,
10
+ sharpapi-0.3.3.dist-info/METADATA,sha256=29KTiq6hkSeolWRxKVXpihnTWs1hJ6_pSJj3EXkVlb4,5735
11
+ sharpapi-0.3.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
12
+ sharpapi-0.3.3.dist-info/licenses/LICENSE,sha256=EfZuzcYtp0eJC9ky4Nei3os5r0cFBYQmc-TpamV5OPw,1069
13
+ sharpapi-0.3.3.dist-info/RECORD,,