toutsurmoneau.fr has just been updated as we can see in the source code :
API calls doesn't work anymore but the fix is simple.
After some testing with Python, we now need to call the API with the hostname returned by the redirection when posting credentials, everything else hasn't been changed and works the same way as before.
Indeed calling the API with the base URI before redirection doesn't work anymore.
Here is the code fragment that works :
// getting token works the same way as before
// except we need to handle unicode_escape
token = regexresult.encode().decode('unicode_escape')
// posting credentials also works the same way as before
response = session.post( url, data=data, cookies=response.cookies, allow_redirects=True, timeout=None )
// now we must get the hostname we've been redirected to
hostname = re.match('https?://([^/]+)/',response.url).group(1)
// and then call the API with this hostname (And not by using BASE_URI constant)
url = "https://" + hostname + API_ENDPOINT_DATA
url += '{}/{}/{}'.format( yesterday_year, yesterday_month, counter_id)
response = session.get( url )
// Also, there's no need to extract eZSESSID and pass "Cookie" http header anymore, since cookies are kept between 2 session calls and the protocol directly use them. It still works if anyway if we continue to pass this header but all this code can safely be removed.
@ooii again thanks for your work
toutsurmoneau.fr has just been updated as we can see in the source code :
API calls doesn't work anymore but the fix is simple.
After some testing with Python, we now need to call the API with the hostname returned by the redirection when posting credentials, everything else hasn't been changed and works the same way as before.
Indeed calling the API with the base URI before redirection doesn't work anymore.
Here is the code fragment that works :
// getting token works the same way as before // except we need to handle unicode_escape token = regexresult.encode().decode('unicode_escape')
// posting credentials also works the same way as before response = session.post( url, data=data, cookies=response.cookies, allow_redirects=True, timeout=None )
// now we must get the hostname we've been redirected to hostname = re.match('https?://([^/]+)/',response.url).group(1)
// and then call the API with this hostname (And not by using BASE_URI constant) url = "https://" + hostname + API_ENDPOINT_DATA url += '{}/{}/{}'.format( yesterday_year, yesterday_month, counter_id) response = session.get( url )
// Also, there's no need to extract eZSESSID and pass "Cookie" http header anymore, since cookies are kept between 2 session calls and the protocol directly use them. It still works if anyway if we continue to pass this header but all this code can safely be removed.