seatdata-sdk 0.1.0__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.
- seatdata/__init__.py +5 -0
- seatdata/client.py +128 -0
- seatdata/exceptions.py +10 -0
- seatdata_sdk-0.1.0.dist-info/METADATA +89 -0
- seatdata_sdk-0.1.0.dist-info/RECORD +8 -0
- seatdata_sdk-0.1.0.dist-info/WHEEL +5 -0
- seatdata_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
- seatdata_sdk-0.1.0.dist-info/top_level.txt +1 -0
seatdata/__init__.py
ADDED
seatdata/client.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from typing import Dict, Any, Optional, List
|
|
2
|
+
import requests
|
|
3
|
+
|
|
4
|
+
from .exceptions import SeatDataException, AuthenticationError, RateLimitError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SeatDataClient:
|
|
8
|
+
BASE_URL = "https://seatdata.io/api"
|
|
9
|
+
|
|
10
|
+
def __init__(self, api_key: str, timeout: int = 30):
|
|
11
|
+
if not api_key or len(api_key) != 64:
|
|
12
|
+
raise ValueError("API key must be a 64-character hexadecimal string")
|
|
13
|
+
|
|
14
|
+
self.api_key = api_key
|
|
15
|
+
self.timeout = timeout
|
|
16
|
+
self.session = requests.Session()
|
|
17
|
+
self.session.headers.update({
|
|
18
|
+
"api-key": api_key,
|
|
19
|
+
"User-Agent": "SeatData-Python-SDK/0.1.0"
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
def _make_request(
|
|
23
|
+
self,
|
|
24
|
+
method: str,
|
|
25
|
+
endpoint: str,
|
|
26
|
+
params: Optional[Dict[str, Any]] = None,
|
|
27
|
+
json_data: Optional[Dict[str, Any]] = None
|
|
28
|
+
) -> Any:
|
|
29
|
+
url = self.BASE_URL + endpoint
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
response = self.session.request(
|
|
33
|
+
method=method,
|
|
34
|
+
url=url,
|
|
35
|
+
params=params,
|
|
36
|
+
json=json_data,
|
|
37
|
+
timeout=self.timeout
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if response.status_code == 401:
|
|
41
|
+
raise AuthenticationError("Invalid API key")
|
|
42
|
+
elif response.status_code == 429:
|
|
43
|
+
raise RateLimitError("Rate limit exceeded")
|
|
44
|
+
elif response.status_code == 400:
|
|
45
|
+
raise SeatDataException(f"Bad request: {response.text}")
|
|
46
|
+
|
|
47
|
+
response.raise_for_status()
|
|
48
|
+
|
|
49
|
+
return response.json()
|
|
50
|
+
|
|
51
|
+
except requests.exceptions.RequestException as e:
|
|
52
|
+
raise SeatDataException(f"Request failed: {str(e)}")
|
|
53
|
+
|
|
54
|
+
def get_sales_data(
|
|
55
|
+
self,
|
|
56
|
+
event_id: Optional[str] = None,
|
|
57
|
+
event_id_sh: Optional[str] = None
|
|
58
|
+
) -> List[Dict[str, Any]]:
|
|
59
|
+
if not event_id and not event_id_sh:
|
|
60
|
+
raise ValueError("Either event_id or event_id_sh must be provided")
|
|
61
|
+
|
|
62
|
+
params = {}
|
|
63
|
+
if event_id:
|
|
64
|
+
params["event_id"] = event_id
|
|
65
|
+
if event_id_sh:
|
|
66
|
+
params["event_id_sh"] = event_id_sh
|
|
67
|
+
|
|
68
|
+
return self._make_request("GET", "/v0.3/salesdata/get", params=params)
|
|
69
|
+
|
|
70
|
+
def get_listings(
|
|
71
|
+
self,
|
|
72
|
+
event_id: Optional[str] = None,
|
|
73
|
+
event_id_sh: Optional[str] = None
|
|
74
|
+
) -> Dict[str, Any]:
|
|
75
|
+
if not event_id and not event_id_sh:
|
|
76
|
+
raise ValueError("Either event_id or event_id_sh must be provided")
|
|
77
|
+
|
|
78
|
+
params = {}
|
|
79
|
+
if event_id:
|
|
80
|
+
params["event_id"] = event_id
|
|
81
|
+
if event_id_sh:
|
|
82
|
+
params["event_id_sh"] = event_id_sh
|
|
83
|
+
|
|
84
|
+
return self._make_request("GET", "/v0.1/listings/get", params=params)
|
|
85
|
+
|
|
86
|
+
def search_events(
|
|
87
|
+
self,
|
|
88
|
+
event_name: Optional[str] = None,
|
|
89
|
+
event_date: Optional[str] = None,
|
|
90
|
+
venue_name: Optional[str] = None,
|
|
91
|
+
venue_city: Optional[str] = None,
|
|
92
|
+
venue_state: Optional[str] = None,
|
|
93
|
+
return_full_response: bool = False,
|
|
94
|
+
**kwargs
|
|
95
|
+
) -> List[Dict[str, Any]]:
|
|
96
|
+
search_params = {}
|
|
97
|
+
|
|
98
|
+
if event_name:
|
|
99
|
+
search_params["event_name"] = event_name
|
|
100
|
+
if event_date:
|
|
101
|
+
search_params["event_date"] = event_date
|
|
102
|
+
if venue_name:
|
|
103
|
+
search_params["venue_name"] = venue_name
|
|
104
|
+
if venue_city:
|
|
105
|
+
search_params["venue_city"] = venue_city
|
|
106
|
+
if venue_state:
|
|
107
|
+
search_params["venue_state"] = venue_state
|
|
108
|
+
|
|
109
|
+
search_params.update(kwargs)
|
|
110
|
+
|
|
111
|
+
response = self._make_request("POST", "/v0.3.1/events/search", json_data=search_params)
|
|
112
|
+
|
|
113
|
+
if return_full_response:
|
|
114
|
+
return response
|
|
115
|
+
|
|
116
|
+
if isinstance(response, dict) and "items" in response:
|
|
117
|
+
return response["items"]
|
|
118
|
+
|
|
119
|
+
return response
|
|
120
|
+
|
|
121
|
+
def close(self):
|
|
122
|
+
self.session.close()
|
|
123
|
+
|
|
124
|
+
def __enter__(self):
|
|
125
|
+
return self
|
|
126
|
+
|
|
127
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
128
|
+
self.close()
|
seatdata/exceptions.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seatdata-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for SeatData API
|
|
5
|
+
Author-email: SeatData <support@seatdata.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: requests>=2.31.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
24
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
26
|
+
Requires-Dist: types-requests>=2.31.0; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# SeatData Python SDK
|
|
30
|
+
|
|
31
|
+
[](https://badge.fury.io/py/seatdata-sdk)
|
|
32
|
+
[](https://github.com/SeatDataIO/python-sdk/actions/workflows/test.yml)
|
|
33
|
+
[](https://pypi.org/project/seatdata-sdk/)
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
|
|
36
|
+
Official Python SDK for SeatData API - access ticket sales data, event listings, and search functionality.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install seatdata-sdk
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from seatdata import SeatDataClient
|
|
48
|
+
|
|
49
|
+
# Initialize client with your API key
|
|
50
|
+
client = SeatDataClient(api_key="your_64_char_api_key")
|
|
51
|
+
|
|
52
|
+
# Search for events
|
|
53
|
+
events = client.search_events(
|
|
54
|
+
venue_name="Madison Square Garden",
|
|
55
|
+
venue_city="New York"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Get sales data for an event
|
|
59
|
+
sales_data = client.get_sales_data(event_id="1234567")
|
|
60
|
+
|
|
61
|
+
# Get current listings
|
|
62
|
+
listings = client.get_listings(event_id="1234567")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API Key
|
|
66
|
+
|
|
67
|
+
Contact support@seatdata.io to obtain an API key.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Clone the repository
|
|
73
|
+
git clone https://github.com/SeatDataIO/python-sdk.git
|
|
74
|
+
cd python-sdk
|
|
75
|
+
|
|
76
|
+
# Install development dependencies
|
|
77
|
+
pip install -r requirements.txt
|
|
78
|
+
|
|
79
|
+
# Run tests
|
|
80
|
+
pytest
|
|
81
|
+
|
|
82
|
+
# Run integration tests (requires API key)
|
|
83
|
+
export SEATDATA_API_KEY="your_api_key"
|
|
84
|
+
pytest -m integration
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
seatdata/__init__.py,sha256=OM51Vjl4yj_D62k5nwiZDt5_DlHIKZsVQz6yH_dWPkI,227
|
|
2
|
+
seatdata/client.py,sha256=S7z9qEgbpxbZ4KSRuPI0E7lURJLcX5WzZcZ0i3fUdDA,4072
|
|
3
|
+
seatdata/exceptions.py,sha256=kHzUu_Cwk1YKygYywDsFRAzqecL1VOOhcEwetaYSvwM,153
|
|
4
|
+
seatdata_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=vhzMjjdpy9d0Gse2ve8LkTYiQ7fmOXzfgJoMMVi3p5U,1067
|
|
5
|
+
seatdata_sdk-0.1.0.dist-info/METADATA,sha256=9pxifSeJvlSQMS6TtyKYkPDAHWJ-G02F1kYcywOoK0E,2550
|
|
6
|
+
seatdata_sdk-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
seatdata_sdk-0.1.0.dist-info/top_level.txt,sha256=u6_yEP8mh7WrUEse4swQQf-EpxJ56dPMjy6MdfgT5PU,9
|
|
8
|
+
seatdata_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SeatDataIO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
seatdata
|