Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linky.py #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions linky.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ def login(username, password):
'SunQueryParamsString': base64.b64encode(b'realm=particuliers'),
'encoded': 'true',
'gx_charset': 'UTF-8'}


session.headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Mobile Safari/537.36',
'Accept-Language': 'fr,fr-FR;q=0.8,en;q=0.6',
'Accept-Encoding': 'gzip, deflate',
'Accept': 'application/json, text/javascript, */*; q=0.01'}

req = session.post(LOGIN_BASE_URI + API_ENDPOINT_LOGIN, data=payload, allow_redirects=False)

session_cookie = req.cookies.get('iPlanetDirectoryPro')
Expand Down Expand Up @@ -118,4 +124,4 @@ def _get_data(session, resource_id, start_date=None, end_date=None):
if res['etat'] and res['etat']['valeur'] == 'erreur' and res['etat']['erreurText']:
raise LinkyServiceException(html.unescape(res['etat']['erreurText']))

return res
return res