sharpapi 0.3.2__tar.gz → 0.4.0__tar.gz

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.
@@ -14,5 +14,4 @@ build/
14
14
  htmlcov/
15
15
  .claude/
16
16
  .DS_Store
17
- tests/
18
17
  .benchmarks/
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to the `sharpapi` Python SDK are documented here.
4
4
 
5
+ ## 0.4.0 — 2026-06-02
6
+
7
+ ### Changed
8
+
9
+ - `OddsLine.timestamp` / `ArbitrageLeg.timestamp` documented as the **delivery /
10
+ last-refreshed** feed-freshness timestamp (advances every ingest cycle),
11
+ matching OpticOdds' `timestamp` — NOT a price-last-changed time. The API now
12
+ populates this field (previously always `null`). The removed
13
+ `odds_changed_at` / `last_seen_at` / `wire_received_at` were never modeled by
14
+ this SDK, so no model change is needed. (SHA-1048)
15
+
16
+ ### Added
17
+
18
+ - `OddsLine.is_active` (bool, default `True`). `False` indicates the market is
19
+ suspended/closed with the price frozen — mirrors OpticOdds `locked-odds` but
20
+ as a queryable field. Absent on the wire is treated as `True`.
21
+
22
+ ### Backward compatibility
23
+
24
+ - Additive optional field with a `True` default — existing code is unaffected,
25
+ and older API servers that omit the key parse as active.
26
+
5
27
  ## 0.3.2 — 2026-05-07
6
28
 
7
29
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sharpapi
3
- Version: 0.3.2
3
+ Version: 0.4.0
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sharpapi"
7
- version = "0.3.2"
7
+ version = "0.4.0"
8
8
  description = "Official Python SDK for the SharpAPI real-time sports betting odds API"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -61,7 +61,7 @@ from .models import (
61
61
  )
62
62
  from .streaming import EventStream
63
63
 
64
- __version__ = "0.3.1"
64
+ __version__ = "0.4.0"
65
65
 
66
66
  __all__ = [
67
67
  # Clients
@@ -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:
@@ -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",
@@ -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",
@@ -219,8 +219,15 @@ class OddsLine(BaseModel):
219
219
  probability: float
220
220
  line: float | None = None
221
221
  event_start_time: str | None = None
222
+ # ISO 8601 — when SharpAPI last refreshed this odd through its pipeline
223
+ # (advances every ingest cycle). A feed-freshness / delivery signal matching
224
+ # OpticOdds' `timestamp`; NOT a price-last-changed time. (SHA-1048)
222
225
  timestamp: str | None = None
223
226
  is_live: bool = False
227
+ # True (default) = market open and bettable; False = market suspended/closed
228
+ # with the price frozen (mirrors OpticOdds locked-odds). Absent on the wire
229
+ # is treated as True. SHA-3803.
230
+ is_active: bool = True
224
231
  deep_link: str | None = None
225
232
  player_name: str | None = None
226
233
  stat_category: str | None = None
@@ -311,6 +318,8 @@ class ArbitrageLeg(BaseModel):
311
318
  odds_decimal: float
312
319
  implied_probability: float | None = None
313
320
  stake_percent: float
321
+ # ISO 8601 last-refreshed (feed-freshness) timestamp for this leg's odd —
322
+ # see OddsLine.timestamp. (SHA-1048)
314
323
  timestamp: str | None = None
315
324
  external_event_id: str | None = None
316
325
  selection_id: str | None = None
File without changes
File without changes
File without changes
File without changes