from requests_oauth2client import OAuth2Client, OAuth2ClientCredentialsAuth, ApiClient class HelloassoAppClient: def __init__(self, client_id, client_secret): self.client_id = client_id self.client_secret = client_secret self.oauth2client = OAuth2Client( token_endpoint="https://api.helloasso.com/oauth2/token", client_id=self.client_id, client_secret=self.client_secret ) self.auth = OAuth2ClientCredentialsAuth(self.oauth2client) self.client = ApiClient( "https://api.helloasso.com/v5", auth=self.auth ) class HelloassoUserClient: def __init__(self, email, password): self.email = email self.password = password self.client = ApiClient( "https://api.helloasso.com/v5", headers = {"User-Agent": "Mozilla/5.0", "accept-language": "en-US,en"} ) def login(self): self.client.post("/auth/login", data={}) class Organization(): client: HelloassoClient slug: str def __init__(self, client, slug): self.client = client self.slug = slug def list_payments(self): res = self.client.client.get(f"/organizations/{self.slug}/payments") # FIXME : ahndle pagination , cannot test right now because of not enought ppl return res.json()