rozzac90 / matchbook

Python wrapper for Matchbook API
MIT License
15 stars 10 forks source link

How to handle long polling of auth endpoints? #18

Open Cally99 opened 2 years ago

Cally99 commented 2 years ago

I'm using the following code to auth and poll for long periods, more than 6 hours.

from matchbook.apiclient import APIClient MATCHBOOK_USER = MATCHBOOK_PW = api = APIClient('MATCHBOOK_USER', MATCHBOOK_PW)

def get_client(): if not api.session_token: api.login() logger.warning(f'login has been called{api}') return api

def get_orders(self):

api = get_client()
r = api.betting.get_orders()

Get orders is polled for long periods of time but after 6 hours I'm unable to access resource since my session token has expired.

how do you use the wrapper to create a new session after 6 hours? I tried to use keep_alive but I ended up being blocked from the api.

It would be great if there could be some documentation of how keep_alive works. Thanks