Skip to content

Instantly share code, notes, and snippets.

@alvmgdev
Last active March 16, 2025 21:56
Script to connect to ps3838 API
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())
@damienld
Copy link

damienld commented Jan 14, 2021

Just change v1 to v3 everywhere like https://api.ps3838.com/v3/

@alvmgdev
Copy link
Author

It looks like it has stopped working. I get this message when I try to connect.

This API has been decommissioned, kindly switch to use newer version of API. \nPlease refer: https://ps3838api.github.io/docs/

Any ideas?

I am not using this snippet anymore, but checking the api docs, it looks like v1 is deprecated, and you should change v1 prefix to v3 like @damienId advice you

@alvmgdev
Copy link
Author

Just change v1 to v3 everywhere like https://api.ps3838.com/v3/

Thanks

@Nikos2890
Copy link

Thanks for your code, very useful

I tried to launch a POST request via /v2/bets/place but it failed (<Response [405]>)

Any ideas ?

@damienld
Copy link

damienld commented Jan 2, 2025

Is it still working?
api.ps3838.com/v3/
gives nothing to me anymore

@alvmgdev
Copy link
Author

alvmgdev commented Jan 2, 2025

Is it still working? api.ps3838.com/v3/ gives nothing to me anymore

Yes, it is still working.
Api v1 had been decommissioned but v3 still looks good.

This is a sample script to make an http request. You can find the docs of the consumed api here: https://www.ps3838.com/static/index.php/en/help/api-user-guide

The api.ps3838.com/v3/ only redirect to the main api page. api.ps3838.com/v3/ is not and endpoint...

@cinek19
Copy link

cinek19 commented Mar 16, 2025

To log in, which username and password do I need, the API's or PS3838's own?

@alvmgdev
Copy link
Author

To log in, which username and password do I need, the API's or PS3838's own?

The username and password that you use in ps3838

@damienld
Copy link

To log in, which username and password do I need, the API's or PS3838's own?

PS3838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment