predictorsdk 0.0.1__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.
- predictorsdk-0.0.1/PKG-INFO +45 -0
- predictorsdk-0.0.1/README.md +30 -0
- predictorsdk-0.0.1/predictorsdk/__init__.py +69 -0
- predictorsdk-0.0.1/predictorsdk/client.py +305 -0
- predictorsdk-0.0.1/predictorsdk/core/__init__.py +125 -0
- predictorsdk-0.0.1/predictorsdk/core/api_error.py +23 -0
- predictorsdk-0.0.1/predictorsdk/core/client_wrapper.py +103 -0
- predictorsdk-0.0.1/predictorsdk/core/datetime_utils.py +70 -0
- predictorsdk-0.0.1/predictorsdk/core/file.py +67 -0
- predictorsdk-0.0.1/predictorsdk/core/force_multipart.py +18 -0
- predictorsdk-0.0.1/predictorsdk/core/http_client.py +840 -0
- predictorsdk-0.0.1/predictorsdk/core/http_response.py +59 -0
- predictorsdk-0.0.1/predictorsdk/core/http_sse/__init__.py +42 -0
- predictorsdk-0.0.1/predictorsdk/core/http_sse/_api.py +112 -0
- predictorsdk-0.0.1/predictorsdk/core/http_sse/_decoders.py +61 -0
- predictorsdk-0.0.1/predictorsdk/core/http_sse/_exceptions.py +7 -0
- predictorsdk-0.0.1/predictorsdk/core/http_sse/_models.py +17 -0
- predictorsdk-0.0.1/predictorsdk/core/jsonable_encoder.py +108 -0
- predictorsdk-0.0.1/predictorsdk/core/logging.py +107 -0
- predictorsdk-0.0.1/predictorsdk/core/parse_error.py +36 -0
- predictorsdk-0.0.1/predictorsdk/core/pydantic_utilities.py +634 -0
- predictorsdk-0.0.1/predictorsdk/core/query_encoder.py +58 -0
- predictorsdk-0.0.1/predictorsdk/core/remove_none_from_dict.py +11 -0
- predictorsdk-0.0.1/predictorsdk/core/request_options.py +35 -0
- predictorsdk-0.0.1/predictorsdk/core/serialization.py +276 -0
- predictorsdk-0.0.1/predictorsdk/environment.py +7 -0
- predictorsdk-0.0.1/predictorsdk/errors/__init__.py +44 -0
- predictorsdk-0.0.1/predictorsdk/errors/bad_request_error.py +11 -0
- predictorsdk-0.0.1/predictorsdk/errors/forbidden_error.py +11 -0
- predictorsdk-0.0.1/predictorsdk/errors/service_unavailable_error.py +11 -0
- predictorsdk-0.0.1/predictorsdk/errors/too_many_requests_error.py +11 -0
- predictorsdk-0.0.1/predictorsdk/errors/unauthorized_error.py +11 -0
- predictorsdk-0.0.1/predictorsdk/raw_client.py +267 -0
- predictorsdk-0.0.1/predictorsdk/types/__init__.py +42 -0
- predictorsdk-0.0.1/predictorsdk/types/error_response.py +20 -0
- predictorsdk-0.0.1/predictorsdk/types/platform_market.py +49 -0
- predictorsdk-0.0.1/predictorsdk/types/platform_market_platform.py +5 -0
- predictorsdk-0.0.1/predictorsdk/types/sports_matching_response.py +23 -0
- predictorsdk-0.0.1/predictorsdk.egg-info/PKG-INFO +45 -0
- predictorsdk-0.0.1/predictorsdk.egg-info/SOURCES.txt +43 -0
- predictorsdk-0.0.1/predictorsdk.egg-info/dependency_links.txt +1 -0
- predictorsdk-0.0.1/predictorsdk.egg-info/requires.txt +3 -0
- predictorsdk-0.0.1/predictorsdk.egg-info/top_level.txt +1 -0
- predictorsdk-0.0.1/pyproject.toml +25 -0
- predictorsdk-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: predictorsdk
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: The official Python client for the PredictorSDK matching markets API
|
|
5
|
+
Author-email: PredictorSDK <nick@predictorsdk.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://docs.predictorsdk.com
|
|
8
|
+
Project-URL: Repository, https://github.com/PredictorSDK/sdk-python
|
|
9
|
+
Project-URL: Issues, https://github.com/PredictorSDK/sdk-python/issues
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: httpx>=0.21.2
|
|
13
|
+
Requires-Dist: pydantic>=1.9.2
|
|
14
|
+
Requires-Dist: typing_extensions>=4.0.0
|
|
15
|
+
|
|
16
|
+
# predictorsdk
|
|
17
|
+
|
|
18
|
+
The official Python client for the [PredictorSDK](https://predictorsdk.com) matching markets API.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install predictorsdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from predictorsdk import PredictorSDK
|
|
30
|
+
|
|
31
|
+
client = PredictorSDK(token="your-api-key")
|
|
32
|
+
|
|
33
|
+
response = client.get_sports_matching_markets(
|
|
34
|
+
kalshi_event_ticker="KXMLB-25-NYM-COL-2025-04-03",
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
- [Docs](https://docs.predictorsdk.com)
|
|
41
|
+
- [API Reference](https://docs.predictorsdk.com/api-reference)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
[MIT](https://github.com/PredictorSDK/sdk-python/blob/main/LICENSE)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# predictorsdk
|
|
2
|
+
|
|
3
|
+
The official Python client for the [PredictorSDK](https://predictorsdk.com) matching markets API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install predictorsdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from predictorsdk import PredictorSDK
|
|
15
|
+
|
|
16
|
+
client = PredictorSDK(token="your-api-key")
|
|
17
|
+
|
|
18
|
+
response = client.get_sports_matching_markets(
|
|
19
|
+
kalshi_event_ticker="KXMLB-25-NYM-COL-2025-04-03",
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- [Docs](https://docs.predictorsdk.com)
|
|
26
|
+
- [API Reference](https://docs.predictorsdk.com/api-reference)
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
[MIT](https://github.com/PredictorSDK/sdk-python/blob/main/LICENSE)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import ErrorResponse, PlatformMarket, PlatformMarketPlatform, SportsMatchingResponse
|
|
10
|
+
from .errors import (
|
|
11
|
+
BadRequestError,
|
|
12
|
+
ForbiddenError,
|
|
13
|
+
ServiceUnavailableError,
|
|
14
|
+
TooManyRequestsError,
|
|
15
|
+
UnauthorizedError,
|
|
16
|
+
)
|
|
17
|
+
from .client import AsyncPredictorSdkApi, PredictorSdkApi
|
|
18
|
+
from .environment import PredictorSdkApiEnvironment
|
|
19
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
20
|
+
"AsyncPredictorSdkApi": ".client",
|
|
21
|
+
"BadRequestError": ".errors",
|
|
22
|
+
"ErrorResponse": ".types",
|
|
23
|
+
"ForbiddenError": ".errors",
|
|
24
|
+
"PlatformMarket": ".types",
|
|
25
|
+
"PlatformMarketPlatform": ".types",
|
|
26
|
+
"PredictorSdkApi": ".client",
|
|
27
|
+
"PredictorSdkApiEnvironment": ".environment",
|
|
28
|
+
"ServiceUnavailableError": ".errors",
|
|
29
|
+
"SportsMatchingResponse": ".types",
|
|
30
|
+
"TooManyRequestsError": ".errors",
|
|
31
|
+
"UnauthorizedError": ".errors",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
36
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
37
|
+
if module_name is None:
|
|
38
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
39
|
+
try:
|
|
40
|
+
module = import_module(module_name, __package__)
|
|
41
|
+
if module_name == f".{attr_name}":
|
|
42
|
+
return module
|
|
43
|
+
else:
|
|
44
|
+
return getattr(module, attr_name)
|
|
45
|
+
except ImportError as e:
|
|
46
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
47
|
+
except AttributeError as e:
|
|
48
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def __dir__():
|
|
52
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
53
|
+
return sorted(lazy_attrs)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
__all__ = [
|
|
57
|
+
"AsyncPredictorSdkApi",
|
|
58
|
+
"BadRequestError",
|
|
59
|
+
"ErrorResponse",
|
|
60
|
+
"ForbiddenError",
|
|
61
|
+
"PlatformMarket",
|
|
62
|
+
"PlatformMarketPlatform",
|
|
63
|
+
"PredictorSdkApi",
|
|
64
|
+
"PredictorSdkApiEnvironment",
|
|
65
|
+
"ServiceUnavailableError",
|
|
66
|
+
"SportsMatchingResponse",
|
|
67
|
+
"TooManyRequestsError",
|
|
68
|
+
"UnauthorizedError",
|
|
69
|
+
]
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
|
+
from .core.logging import LogConfig, Logger
|
|
8
|
+
from .core.request_options import RequestOptions
|
|
9
|
+
from .environment import PredictorSdkApiEnvironment
|
|
10
|
+
from .raw_client import AsyncRawPredictorSdkApi, RawPredictorSdkApi
|
|
11
|
+
from .types.sports_matching_response import SportsMatchingResponse
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PredictorSdkApi:
|
|
15
|
+
"""
|
|
16
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
base_url : typing.Optional[str]
|
|
21
|
+
The base url to use for requests from the client.
|
|
22
|
+
|
|
23
|
+
environment : PredictorSdkApiEnvironment
|
|
24
|
+
The environment to use for requests from the client. from .environment import PredictorSdkApiEnvironment
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Defaults to PredictorSdkApiEnvironment.PRODUCTION
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
33
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
|
34
|
+
Additional headers to send with every request.
|
|
35
|
+
|
|
36
|
+
timeout : typing.Optional[float]
|
|
37
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
38
|
+
|
|
39
|
+
follow_redirects : typing.Optional[bool]
|
|
40
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
41
|
+
|
|
42
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
43
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
44
|
+
|
|
45
|
+
logging : typing.Optional[typing.Union[LogConfig, Logger]]
|
|
46
|
+
Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
|
|
47
|
+
|
|
48
|
+
Examples
|
|
49
|
+
--------
|
|
50
|
+
from predictorsdk import PredictorSdkApi
|
|
51
|
+
|
|
52
|
+
client = PredictorSdkApi(
|
|
53
|
+
token="YOUR_TOKEN",
|
|
54
|
+
)
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def __init__(
|
|
58
|
+
self,
|
|
59
|
+
*,
|
|
60
|
+
base_url: typing.Optional[str] = None,
|
|
61
|
+
environment: PredictorSdkApiEnvironment = PredictorSdkApiEnvironment.PRODUCTION,
|
|
62
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
63
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
64
|
+
timeout: typing.Optional[float] = None,
|
|
65
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
66
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
67
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
68
|
+
):
|
|
69
|
+
_defaulted_timeout = (
|
|
70
|
+
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
|
|
71
|
+
)
|
|
72
|
+
self._client_wrapper = SyncClientWrapper(
|
|
73
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
74
|
+
token=token,
|
|
75
|
+
headers=headers,
|
|
76
|
+
httpx_client=httpx_client
|
|
77
|
+
if httpx_client is not None
|
|
78
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
79
|
+
if follow_redirects is not None
|
|
80
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
81
|
+
timeout=_defaulted_timeout,
|
|
82
|
+
logging=logging,
|
|
83
|
+
)
|
|
84
|
+
self._raw_client = RawPredictorSdkApi(client_wrapper=self._client_wrapper)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def with_raw_response(self) -> RawPredictorSdkApi:
|
|
88
|
+
"""
|
|
89
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
RawPredictorSdkApi
|
|
94
|
+
"""
|
|
95
|
+
return self._raw_client
|
|
96
|
+
|
|
97
|
+
def get_sports_matching_markets(
|
|
98
|
+
self,
|
|
99
|
+
*,
|
|
100
|
+
kalshi_event_ticker: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
101
|
+
polymarket_market_slug: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
102
|
+
predict_market_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
103
|
+
sxbet_market_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
104
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
105
|
+
) -> SportsMatchingResponse:
|
|
106
|
+
"""
|
|
107
|
+
Find cross-platform market matches for sports events. Provide a Kalshi event ticker or Polymarket market slug to look up the equivalent market on other platforms. When called without parameters, returns all currently matched sports markets.
|
|
108
|
+
|
|
109
|
+
Parameters
|
|
110
|
+
----------
|
|
111
|
+
kalshi_event_ticker : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
112
|
+
Kalshi event ticker(s) to find matching markets for (e.g. `KXNFLGAME-25AUG16ARIDEN`). Provide the parameter multiple times for multiple tickers. Only one filter type may be used per request.
|
|
113
|
+
|
|
114
|
+
polymarket_market_slug : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
115
|
+
Polymarket market slug(s) to find matching markets for (e.g. `nfl-ari-den-2025-08-16`). Provide the parameter multiple times for multiple slugs. Only one filter type may be used per request.
|
|
116
|
+
|
|
117
|
+
predict_market_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
118
|
+
Predict market ID(s) to find matching markets for (e.g. `110629`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
|
|
119
|
+
|
|
120
|
+
sxbet_market_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
121
|
+
SX Bet market ID(s) to find matching markets for (e.g. `0x4c000abdbf197ef32ecdf15561b1d636f1e5b02629f466678757fd83e2ec3599`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
|
|
122
|
+
|
|
123
|
+
request_options : typing.Optional[RequestOptions]
|
|
124
|
+
Request-specific configuration.
|
|
125
|
+
|
|
126
|
+
Returns
|
|
127
|
+
-------
|
|
128
|
+
SportsMatchingResponse
|
|
129
|
+
Matching markets keyed by identifier
|
|
130
|
+
|
|
131
|
+
Examples
|
|
132
|
+
--------
|
|
133
|
+
from predictorsdk import PredictorSdkApi
|
|
134
|
+
|
|
135
|
+
client = PredictorSdkApi(
|
|
136
|
+
token="YOUR_TOKEN",
|
|
137
|
+
)
|
|
138
|
+
client.get_sports_matching_markets()
|
|
139
|
+
"""
|
|
140
|
+
_response = self._raw_client.get_sports_matching_markets(
|
|
141
|
+
kalshi_event_ticker=kalshi_event_ticker,
|
|
142
|
+
polymarket_market_slug=polymarket_market_slug,
|
|
143
|
+
predict_market_id=predict_market_id,
|
|
144
|
+
sxbet_market_id=sxbet_market_id,
|
|
145
|
+
request_options=request_options,
|
|
146
|
+
)
|
|
147
|
+
return _response.data
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class AsyncPredictorSdkApi:
|
|
151
|
+
"""
|
|
152
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
153
|
+
|
|
154
|
+
Parameters
|
|
155
|
+
----------
|
|
156
|
+
base_url : typing.Optional[str]
|
|
157
|
+
The base url to use for requests from the client.
|
|
158
|
+
|
|
159
|
+
environment : PredictorSdkApiEnvironment
|
|
160
|
+
The environment to use for requests from the client. from .environment import PredictorSdkApiEnvironment
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
Defaults to PredictorSdkApiEnvironment.PRODUCTION
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
169
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
|
170
|
+
Additional headers to send with every request.
|
|
171
|
+
|
|
172
|
+
async_token : typing.Optional[typing.Callable[[], typing.Awaitable[str]]]
|
|
173
|
+
An async callable that returns a bearer token. Use this when token acquisition involves async I/O (e.g., refreshing tokens via an async HTTP client). When provided, this is used instead of the synchronous token for async requests.
|
|
174
|
+
|
|
175
|
+
timeout : typing.Optional[float]
|
|
176
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
177
|
+
|
|
178
|
+
follow_redirects : typing.Optional[bool]
|
|
179
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
180
|
+
|
|
181
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
182
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
183
|
+
|
|
184
|
+
logging : typing.Optional[typing.Union[LogConfig, Logger]]
|
|
185
|
+
Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
|
|
186
|
+
|
|
187
|
+
Examples
|
|
188
|
+
--------
|
|
189
|
+
from predictorsdk import AsyncPredictorSdkApi
|
|
190
|
+
|
|
191
|
+
client = AsyncPredictorSdkApi(
|
|
192
|
+
token="YOUR_TOKEN",
|
|
193
|
+
)
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
def __init__(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
base_url: typing.Optional[str] = None,
|
|
200
|
+
environment: PredictorSdkApiEnvironment = PredictorSdkApiEnvironment.PRODUCTION,
|
|
201
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
202
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
203
|
+
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
|
|
204
|
+
timeout: typing.Optional[float] = None,
|
|
205
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
206
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
207
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
208
|
+
):
|
|
209
|
+
_defaulted_timeout = (
|
|
210
|
+
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
|
|
211
|
+
)
|
|
212
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
213
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
214
|
+
token=token,
|
|
215
|
+
headers=headers,
|
|
216
|
+
async_token=async_token,
|
|
217
|
+
httpx_client=httpx_client
|
|
218
|
+
if httpx_client is not None
|
|
219
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
220
|
+
if follow_redirects is not None
|
|
221
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
222
|
+
timeout=_defaulted_timeout,
|
|
223
|
+
logging=logging,
|
|
224
|
+
)
|
|
225
|
+
self._raw_client = AsyncRawPredictorSdkApi(client_wrapper=self._client_wrapper)
|
|
226
|
+
|
|
227
|
+
@property
|
|
228
|
+
def with_raw_response(self) -> AsyncRawPredictorSdkApi:
|
|
229
|
+
"""
|
|
230
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
231
|
+
|
|
232
|
+
Returns
|
|
233
|
+
-------
|
|
234
|
+
AsyncRawPredictorSdkApi
|
|
235
|
+
"""
|
|
236
|
+
return self._raw_client
|
|
237
|
+
|
|
238
|
+
async def get_sports_matching_markets(
|
|
239
|
+
self,
|
|
240
|
+
*,
|
|
241
|
+
kalshi_event_ticker: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
242
|
+
polymarket_market_slug: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
243
|
+
predict_market_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
244
|
+
sxbet_market_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
245
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
246
|
+
) -> SportsMatchingResponse:
|
|
247
|
+
"""
|
|
248
|
+
Find cross-platform market matches for sports events. Provide a Kalshi event ticker or Polymarket market slug to look up the equivalent market on other platforms. When called without parameters, returns all currently matched sports markets.
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
kalshi_event_ticker : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
253
|
+
Kalshi event ticker(s) to find matching markets for (e.g. `KXNFLGAME-25AUG16ARIDEN`). Provide the parameter multiple times for multiple tickers. Only one filter type may be used per request.
|
|
254
|
+
|
|
255
|
+
polymarket_market_slug : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
256
|
+
Polymarket market slug(s) to find matching markets for (e.g. `nfl-ari-den-2025-08-16`). Provide the parameter multiple times for multiple slugs. Only one filter type may be used per request.
|
|
257
|
+
|
|
258
|
+
predict_market_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
259
|
+
Predict market ID(s) to find matching markets for (e.g. `110629`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
|
|
260
|
+
|
|
261
|
+
sxbet_market_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
262
|
+
SX Bet market ID(s) to find matching markets for (e.g. `0x4c000abdbf197ef32ecdf15561b1d636f1e5b02629f466678757fd83e2ec3599`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request.
|
|
263
|
+
|
|
264
|
+
request_options : typing.Optional[RequestOptions]
|
|
265
|
+
Request-specific configuration.
|
|
266
|
+
|
|
267
|
+
Returns
|
|
268
|
+
-------
|
|
269
|
+
SportsMatchingResponse
|
|
270
|
+
Matching markets keyed by identifier
|
|
271
|
+
|
|
272
|
+
Examples
|
|
273
|
+
--------
|
|
274
|
+
import asyncio
|
|
275
|
+
|
|
276
|
+
from predictorsdk import AsyncPredictorSdkApi
|
|
277
|
+
|
|
278
|
+
client = AsyncPredictorSdkApi(
|
|
279
|
+
token="YOUR_TOKEN",
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
async def main() -> None:
|
|
284
|
+
await client.get_sports_matching_markets()
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
asyncio.run(main())
|
|
288
|
+
"""
|
|
289
|
+
_response = await self._raw_client.get_sports_matching_markets(
|
|
290
|
+
kalshi_event_ticker=kalshi_event_ticker,
|
|
291
|
+
polymarket_market_slug=polymarket_market_slug,
|
|
292
|
+
predict_market_id=predict_market_id,
|
|
293
|
+
sxbet_market_id=sxbet_market_id,
|
|
294
|
+
request_options=request_options,
|
|
295
|
+
)
|
|
296
|
+
return _response.data
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PredictorSdkApiEnvironment) -> str:
|
|
300
|
+
if base_url is not None:
|
|
301
|
+
return base_url
|
|
302
|
+
elif environment is not None:
|
|
303
|
+
return environment.value
|
|
304
|
+
else:
|
|
305
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .api_error import ApiError
|
|
10
|
+
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
|
11
|
+
from .datetime_utils import Rfc2822DateTime, parse_rfc2822_datetime, serialize_datetime
|
|
12
|
+
from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
|
|
13
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
14
|
+
from .http_response import AsyncHttpResponse, HttpResponse
|
|
15
|
+
from .jsonable_encoder import jsonable_encoder
|
|
16
|
+
from .logging import ConsoleLogger, ILogger, LogConfig, LogLevel, Logger, create_logger
|
|
17
|
+
from .parse_error import ParsingError
|
|
18
|
+
from .pydantic_utilities import (
|
|
19
|
+
IS_PYDANTIC_V2,
|
|
20
|
+
UniversalBaseModel,
|
|
21
|
+
UniversalRootModel,
|
|
22
|
+
parse_obj_as,
|
|
23
|
+
universal_field_validator,
|
|
24
|
+
universal_root_validator,
|
|
25
|
+
update_forward_refs,
|
|
26
|
+
)
|
|
27
|
+
from .query_encoder import encode_query
|
|
28
|
+
from .remove_none_from_dict import remove_none_from_dict
|
|
29
|
+
from .request_options import RequestOptions
|
|
30
|
+
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
31
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
32
|
+
"ApiError": ".api_error",
|
|
33
|
+
"AsyncClientWrapper": ".client_wrapper",
|
|
34
|
+
"AsyncHttpClient": ".http_client",
|
|
35
|
+
"AsyncHttpResponse": ".http_response",
|
|
36
|
+
"BaseClientWrapper": ".client_wrapper",
|
|
37
|
+
"ConsoleLogger": ".logging",
|
|
38
|
+
"FieldMetadata": ".serialization",
|
|
39
|
+
"File": ".file",
|
|
40
|
+
"HttpClient": ".http_client",
|
|
41
|
+
"HttpResponse": ".http_response",
|
|
42
|
+
"ILogger": ".logging",
|
|
43
|
+
"IS_PYDANTIC_V2": ".pydantic_utilities",
|
|
44
|
+
"LogConfig": ".logging",
|
|
45
|
+
"LogLevel": ".logging",
|
|
46
|
+
"Logger": ".logging",
|
|
47
|
+
"ParsingError": ".parse_error",
|
|
48
|
+
"RequestOptions": ".request_options",
|
|
49
|
+
"Rfc2822DateTime": ".datetime_utils",
|
|
50
|
+
"SyncClientWrapper": ".client_wrapper",
|
|
51
|
+
"UniversalBaseModel": ".pydantic_utilities",
|
|
52
|
+
"UniversalRootModel": ".pydantic_utilities",
|
|
53
|
+
"convert_and_respect_annotation_metadata": ".serialization",
|
|
54
|
+
"convert_file_dict_to_httpx_tuples": ".file",
|
|
55
|
+
"create_logger": ".logging",
|
|
56
|
+
"encode_query": ".query_encoder",
|
|
57
|
+
"jsonable_encoder": ".jsonable_encoder",
|
|
58
|
+
"parse_obj_as": ".pydantic_utilities",
|
|
59
|
+
"parse_rfc2822_datetime": ".datetime_utils",
|
|
60
|
+
"remove_none_from_dict": ".remove_none_from_dict",
|
|
61
|
+
"serialize_datetime": ".datetime_utils",
|
|
62
|
+
"universal_field_validator": ".pydantic_utilities",
|
|
63
|
+
"universal_root_validator": ".pydantic_utilities",
|
|
64
|
+
"update_forward_refs": ".pydantic_utilities",
|
|
65
|
+
"with_content_type": ".file",
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
70
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
71
|
+
if module_name is None:
|
|
72
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
73
|
+
try:
|
|
74
|
+
module = import_module(module_name, __package__)
|
|
75
|
+
if module_name == f".{attr_name}":
|
|
76
|
+
return module
|
|
77
|
+
else:
|
|
78
|
+
return getattr(module, attr_name)
|
|
79
|
+
except ImportError as e:
|
|
80
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
81
|
+
except AttributeError as e:
|
|
82
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def __dir__():
|
|
86
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
87
|
+
return sorted(lazy_attrs)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
"ApiError",
|
|
92
|
+
"AsyncClientWrapper",
|
|
93
|
+
"AsyncHttpClient",
|
|
94
|
+
"AsyncHttpResponse",
|
|
95
|
+
"BaseClientWrapper",
|
|
96
|
+
"ConsoleLogger",
|
|
97
|
+
"FieldMetadata",
|
|
98
|
+
"File",
|
|
99
|
+
"HttpClient",
|
|
100
|
+
"HttpResponse",
|
|
101
|
+
"ILogger",
|
|
102
|
+
"IS_PYDANTIC_V2",
|
|
103
|
+
"LogConfig",
|
|
104
|
+
"LogLevel",
|
|
105
|
+
"Logger",
|
|
106
|
+
"ParsingError",
|
|
107
|
+
"RequestOptions",
|
|
108
|
+
"Rfc2822DateTime",
|
|
109
|
+
"SyncClientWrapper",
|
|
110
|
+
"UniversalBaseModel",
|
|
111
|
+
"UniversalRootModel",
|
|
112
|
+
"convert_and_respect_annotation_metadata",
|
|
113
|
+
"convert_file_dict_to_httpx_tuples",
|
|
114
|
+
"create_logger",
|
|
115
|
+
"encode_query",
|
|
116
|
+
"jsonable_encoder",
|
|
117
|
+
"parse_obj_as",
|
|
118
|
+
"parse_rfc2822_datetime",
|
|
119
|
+
"remove_none_from_dict",
|
|
120
|
+
"serialize_datetime",
|
|
121
|
+
"universal_field_validator",
|
|
122
|
+
"universal_root_validator",
|
|
123
|
+
"update_forward_refs",
|
|
124
|
+
"with_content_type",
|
|
125
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiError(Exception):
|
|
7
|
+
headers: Optional[Dict[str, str]]
|
|
8
|
+
status_code: Optional[int]
|
|
9
|
+
body: Any
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
headers: Optional[Dict[str, str]] = None,
|
|
15
|
+
status_code: Optional[int] = None,
|
|
16
|
+
body: Any = None,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.headers = headers
|
|
19
|
+
self.status_code = status_code
|
|
20
|
+
self.body = body
|
|
21
|
+
|
|
22
|
+
def __str__(self) -> str:
|
|
23
|
+
return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"
|