ps3838api 0.1.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.

Potentially problematic release.


This version of ps3838api might be problematic. Click here for more details.

@@ -0,0 +1,8 @@
1
+ Copyright 2025 Ilias Dzhabbarov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the β€œSoftware”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED β€œAS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: ps3838api
3
+ Version: 0.1.0
4
+ Summary: Modern PS3838 API
5
+ Author-email: Ilias Dzhabbarov <ilias.dzabbarov@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/iliyasone/ps3838api
8
+ Project-URL: Issues, https://github.com/iliyasone/ps3838api/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests
16
+ Requires-Dist: rapidfuzz
17
+ Dynamic: license-file
18
+
19
+ # Modern PS3838 API
20
+
21
+ A lightweight Python library to interact with the PS3838 API.
22
+
23
+ ## πŸ”‘ Key Idea
24
+
25
+ This project aims to keep all method names and behavior as close as possible to the official [PS3838 API documentation](https://ps3838api.github.io/docs/). No abstraction layers that get in your way β€” just a clean, Pythonic functional interface to the raw API.
26
+
27
+ If you need assistance, contact me directly on Telegram: [@iliyasone](https://t.me/iliyasone) πŸ’¬
28
+
29
+ ## ✨ Features
30
+
31
+ ### `ps3838api.api` β€” Minimalist, Typed API Wrapper
32
+
33
+ - **Simple & Clear:** All commonly used endpoints are exposed as straightforward Python functions.
34
+ - **Type-Safe:** Responses are structured using precise `TypedDict` definitions based directly on the official docs.
35
+ - **Clean Data:** Say goodbye to messy, undocumented JSON blobs.
36
+ - **Lightweight:** No bloated ORMs or clunky third-party wrappers β€” just clean, readable code.
37
+
38
+ ### Event & Odds Matching
39
+
40
+ - Utility functions like `magic_find_event` and `filter_odds` help you match events and filter odds quickly and effortlessly πŸ”.
41
+
42
+ ### Bet Placement
43
+
44
+ - Place bets with simple functions that eliminate unnecessary overhead. Fast and efficient, just as you like it!
45
+
46
+ ## πŸš€ Setup
47
+
48
+ > You can also check out the [πŸ““ examples.ipynb](https://github.com/iliyasone/ps3838api/blob/release/0.1.0/examples/examples.ipynb) for a quick start!
49
+
50
+ ### 1. Set Environment Variables
51
+
52
+ Before using the library, set your API credentials via environment variables:
53
+
54
+ ```python
55
+ import os
56
+
57
+ os.environ["PS3838_LOGIN"] = "your_username"
58
+ os.environ["PS3838_PASSWORD"] = "your_password"
59
+ ```
60
+
61
+ > **Note:** After version 1.0, the library will transition to a client-based API instead of just functions.
62
+
63
+ ---
64
+
65
+ ### 2. Check Client Balance
66
+
67
+ Quickly check your account balance by calling the API:
68
+
69
+ ```python
70
+ import ps3838api.api as ps
71
+
72
+ balance = ps.get_client_balance()
73
+ print("Client Balance:", balance)
74
+ ```
75
+
76
+ Expected output:
77
+
78
+ ```json
79
+ {
80
+ "availableBalance": 200.0,
81
+ "outstandingTransactions": 0.0,
82
+ "givenCredit": 0.0,
83
+ "currency": "USD"
84
+ }
85
+ ```
86
+
87
+ ## 🎯 Retrieve Event and Place Bet
88
+
89
+ Find and use events with ease:
90
+
91
+ ```python
92
+ league = 'Russia - Cup'
93
+ home = 'Lokomotiv Moscow'
94
+ away = 'Akhmat Grozny'
95
+
96
+ fixtures = ps.get_fixtures() # sport_id: int = SOCCER_SPORT_ID by default
97
+ ```
98
+
99
+ Match the event using utility functions:
100
+
101
+ ```python
102
+ from ps3838api.matching import magic_find_event
103
+
104
+ event = magic_find_event(fixtures, league, home, away)
105
+ print(event)
106
+ # Example output: {'eventId': 1607937909, 'leagueId': 2409}
107
+ ```
108
+
109
+ Make sure to validate the event:
110
+
111
+ ```python
112
+ assert isinstance(event, dict) # also could be Failure
113
+ ```
114
+
115
+ Filter odds for the selected event:
116
+
117
+ ```python
118
+ from ps3838api.logic import filter_odds
119
+
120
+ odds_response = ps.get_odds()
121
+ odds_eventV3 = filter_odds(odds_response, event_id=event['eventId'])
122
+ ```
123
+
124
+ Select the best total line:
125
+
126
+ ```python
127
+ from ps3838api.totals import get_best_total_line
128
+
129
+ total_line = get_best_total_line(odds_eventV3)
130
+ print(total_line)
131
+ ```
132
+
133
+ An example response:
134
+
135
+ ```json
136
+ {
137
+ "points": 4.5,
138
+ "over": 2.08,
139
+ "under": 1.775,
140
+ "lineId": 3058623866,
141
+ "max": 3750.0
142
+ }
143
+ ```
144
+
145
+ ## πŸ’Έ Place a Bet
146
+
147
+ Once you have your event and total line, place your bet:
148
+
149
+ ```python
150
+ assert isinstance(event, dict) # also could be Failure
151
+ assert total_line is not None
152
+
153
+ import ps3838api.api as ps
154
+
155
+ stake_usdt = 1.0
156
+
157
+ place_bet_response = ps.place_straigh_bet(
158
+ stake=stake_usdt,
159
+ event_id=event['eventId'],
160
+ bet_type='TOTAL_POINTS',
161
+ line_id=total_line.get('lineId', None),
162
+ alt_line_id=total_line.get('altLineId', None),
163
+ side='OVER',
164
+ handicap=total_line['points']
165
+ )
166
+ print("Unique Request ID:", place_bet_response['uniqueRequestId'])
167
+ ```
168
+
169
+ You can also check your bet status:
170
+
171
+ ```python
172
+ bets = ps.get_bets(unique_request_ids=[place_bet_response['uniqueRequestId']])
173
+ # Verify the bet status
174
+ ```
175
+
176
+ ## ⚠️ Known Issues
177
+
178
+ - **Logging:** Not implemented yet.
179
+ - **Testing:** Still missing.
180
+ - **CI/CD:** No GitHub CI/CD integration at the moment.
181
+
182
+ ## πŸ› οΈ Local Installation
183
+
184
+ To install the library locally, run the following commands:
185
+
186
+ ```bash
187
+ git clone https://github.com/iliyasone/ps3838api.git
188
+ cd ps3838api
189
+ pip install . -r dev-requirements.txt
190
+ ```
191
+
192
+ Happy coding
@@ -0,0 +1,174 @@
1
+ # Modern PS3838 API
2
+
3
+ A lightweight Python library to interact with the PS3838 API.
4
+
5
+ ## πŸ”‘ Key Idea
6
+
7
+ This project aims to keep all method names and behavior as close as possible to the official [PS3838 API documentation](https://ps3838api.github.io/docs/). No abstraction layers that get in your way β€” just a clean, Pythonic functional interface to the raw API.
8
+
9
+ If you need assistance, contact me directly on Telegram: [@iliyasone](https://t.me/iliyasone) πŸ’¬
10
+
11
+ ## ✨ Features
12
+
13
+ ### `ps3838api.api` β€” Minimalist, Typed API Wrapper
14
+
15
+ - **Simple & Clear:** All commonly used endpoints are exposed as straightforward Python functions.
16
+ - **Type-Safe:** Responses are structured using precise `TypedDict` definitions based directly on the official docs.
17
+ - **Clean Data:** Say goodbye to messy, undocumented JSON blobs.
18
+ - **Lightweight:** No bloated ORMs or clunky third-party wrappers β€” just clean, readable code.
19
+
20
+ ### Event & Odds Matching
21
+
22
+ - Utility functions like `magic_find_event` and `filter_odds` help you match events and filter odds quickly and effortlessly πŸ”.
23
+
24
+ ### Bet Placement
25
+
26
+ - Place bets with simple functions that eliminate unnecessary overhead. Fast and efficient, just as you like it!
27
+
28
+ ## πŸš€ Setup
29
+
30
+ > You can also check out the [πŸ““ examples.ipynb](https://github.com/iliyasone/ps3838api/blob/release/0.1.0/examples/examples.ipynb) for a quick start!
31
+
32
+ ### 1. Set Environment Variables
33
+
34
+ Before using the library, set your API credentials via environment variables:
35
+
36
+ ```python
37
+ import os
38
+
39
+ os.environ["PS3838_LOGIN"] = "your_username"
40
+ os.environ["PS3838_PASSWORD"] = "your_password"
41
+ ```
42
+
43
+ > **Note:** After version 1.0, the library will transition to a client-based API instead of just functions.
44
+
45
+ ---
46
+
47
+ ### 2. Check Client Balance
48
+
49
+ Quickly check your account balance by calling the API:
50
+
51
+ ```python
52
+ import ps3838api.api as ps
53
+
54
+ balance = ps.get_client_balance()
55
+ print("Client Balance:", balance)
56
+ ```
57
+
58
+ Expected output:
59
+
60
+ ```json
61
+ {
62
+ "availableBalance": 200.0,
63
+ "outstandingTransactions": 0.0,
64
+ "givenCredit": 0.0,
65
+ "currency": "USD"
66
+ }
67
+ ```
68
+
69
+ ## 🎯 Retrieve Event and Place Bet
70
+
71
+ Find and use events with ease:
72
+
73
+ ```python
74
+ league = 'Russia - Cup'
75
+ home = 'Lokomotiv Moscow'
76
+ away = 'Akhmat Grozny'
77
+
78
+ fixtures = ps.get_fixtures() # sport_id: int = SOCCER_SPORT_ID by default
79
+ ```
80
+
81
+ Match the event using utility functions:
82
+
83
+ ```python
84
+ from ps3838api.matching import magic_find_event
85
+
86
+ event = magic_find_event(fixtures, league, home, away)
87
+ print(event)
88
+ # Example output: {'eventId': 1607937909, 'leagueId': 2409}
89
+ ```
90
+
91
+ Make sure to validate the event:
92
+
93
+ ```python
94
+ assert isinstance(event, dict) # also could be Failure
95
+ ```
96
+
97
+ Filter odds for the selected event:
98
+
99
+ ```python
100
+ from ps3838api.logic import filter_odds
101
+
102
+ odds_response = ps.get_odds()
103
+ odds_eventV3 = filter_odds(odds_response, event_id=event['eventId'])
104
+ ```
105
+
106
+ Select the best total line:
107
+
108
+ ```python
109
+ from ps3838api.totals import get_best_total_line
110
+
111
+ total_line = get_best_total_line(odds_eventV3)
112
+ print(total_line)
113
+ ```
114
+
115
+ An example response:
116
+
117
+ ```json
118
+ {
119
+ "points": 4.5,
120
+ "over": 2.08,
121
+ "under": 1.775,
122
+ "lineId": 3058623866,
123
+ "max": 3750.0
124
+ }
125
+ ```
126
+
127
+ ## πŸ’Έ Place a Bet
128
+
129
+ Once you have your event and total line, place your bet:
130
+
131
+ ```python
132
+ assert isinstance(event, dict) # also could be Failure
133
+ assert total_line is not None
134
+
135
+ import ps3838api.api as ps
136
+
137
+ stake_usdt = 1.0
138
+
139
+ place_bet_response = ps.place_straigh_bet(
140
+ stake=stake_usdt,
141
+ event_id=event['eventId'],
142
+ bet_type='TOTAL_POINTS',
143
+ line_id=total_line.get('lineId', None),
144
+ alt_line_id=total_line.get('altLineId', None),
145
+ side='OVER',
146
+ handicap=total_line['points']
147
+ )
148
+ print("Unique Request ID:", place_bet_response['uniqueRequestId'])
149
+ ```
150
+
151
+ You can also check your bet status:
152
+
153
+ ```python
154
+ bets = ps.get_bets(unique_request_ids=[place_bet_response['uniqueRequestId']])
155
+ # Verify the bet status
156
+ ```
157
+
158
+ ## ⚠️ Known Issues
159
+
160
+ - **Logging:** Not implemented yet.
161
+ - **Testing:** Still missing.
162
+ - **CI/CD:** No GitHub CI/CD integration at the moment.
163
+
164
+ ## πŸ› οΈ Local Installation
165
+
166
+ To install the library locally, run the following commands:
167
+
168
+ ```bash
169
+ git clone https://github.com/iliyasone/ps3838api.git
170
+ cd ps3838api
171
+ pip install . -r dev-requirements.txt
172
+ ```
173
+
174
+ Happy coding
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ps3838api"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name = "Ilias Dzhabbarov", email = "ilias.dzabbarov@gmail.com" }
10
+ ]
11
+ description = "Modern PS3838 API"
12
+ readme = "README.md"
13
+ requires-python = ">=3.11"
14
+ license = { text = "MIT" }
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ dependencies = [
21
+ "requests",
22
+ "rapidfuzz"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/iliyasone/ps3838api"
27
+ Issues = "https://github.com/iliyasone/ps3838api/issues"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ from pathlib import Path
2
+
3
+ MODULE_DIR = Path(__file__).resolve().parent
4
+ ROOT_DIR = MODULE_DIR.parent.parent
5
+