-
-
Save alvmgdev/86f98c58c92abf9b72687b9fa3b2f452 to your computer and use it in GitHub Desktop.
| import base64 | |
| import requests | |
| from enum import Enum | |
| """ | |
| Script to connect to ps3838 API | |
| URL to check API User Guide: | |
| https://www.tender88.com/static/index.php/es-es/help/api-user-guide-es-es | |
| In order to access PS3838 API you must have a funded account. | |
| """ | |
| # API ENDPOINT | |
| API_ENDPOINT = 'http://api.ps3838.com' | |
| # Available Request Methods | |
| class HttpMethod(Enum): | |
| GET = 'GET' | |
| POST = 'POST' | |
| # Constants to fill by each user | |
| PS3838_USERNAME = "FILL_USERNAME_HERE" | |
| PS3838_PASSWORD = "FILL_PASSWORD_HERE" | |
| def get_headers(request_method: HttpMethod) -> dict: | |
| headers = {} | |
| headers.update({'Accept': 'application/json'}) | |
| if request_method is HttpMethod.POST: | |
| headers.update({'Content-Type': 'application/json'}) | |
| headers.update({'Authorization': 'Basic {}'.format( | |
| base64.b64encode((bytes("{}:{}".format(PS3838_USERNAME, PS3838_PASSWORD), 'utf-8'))).decode()) | |
| }) | |
| return headers | |
| def get_operation_endpoint(operation: str) -> str: | |
| return '{}{}'.format(API_ENDPOINT, operation) | |
| def get_sports(): | |
| operation = '/v3/sports' | |
| req = requests.get( | |
| get_operation_endpoint(operation), | |
| headers=get_headers(HttpMethod.GET) | |
| ) | |
| return req.json() | |
| # Test retrieve sports endpoint | |
| print(get_sports()) |
{'code': 'NO_API_ACCESS', 'message': 'Account not permitted to access the API'}
It is saying this while I have funded account too!
Any ideas?
I think they removed your access to ps3838 api, the same happened to me. It's seems that they are becoming more restrictive about the use of their API, just like Pinnacle
{'code': 'NO_API_ACCESS', 'message': 'Account not permitted to access the API'}
It is saying this while I have funded account too!
Any ideas?
@ZaryabShah @nm2890 In my case, it is still working!
Perhaps you are using the API to make requests very frequently and they are detecting the usage as "not for personal use".
In their documentation says API Docs this:
Use of the API constitutes your agreement to this policy. You understand and agree that at our sole discretion, and without prior notice, we may block access to our site if we believe that your use of our site has violated or is inconsistent with this Fair Use Policy.
Fair usage
The API is provided to players to facilitate wagering and may not be used for data gathering, scrapping or any other purpose. The API usage must be proportionate to wagering activities as determined on a case by case basis by PS3838.
{'code': 'NO_API_ACCESS', 'message': 'Account not permitted to access the API'}
It is saying this while I have funded account too!
Any ideas?