Getting cookie with python framework

Python and python framework

Moderator: leecollings

Post Reply
Barberousse
Posts: 140
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Getting cookie with python framework

Post by Barberousse »

Hello,

I'm trying to connect to a website with python framework. But I need to connect on a server, which will give a cookie, that I will use on another.

I can log in, the response is correct (I can see it in Debug mode) but I don't manage to get the cookie in received http dictionnary, because it seems to be able to contain only one "Set-Cookie", and http can send many, so it is overwritten. Am I right? Shouldn't headers be a List or a Set?

Code: Select all

2018-04-05 23:08:56.693  (Linky) HTTP Details (2):
2018-04-05 23:08:56.693  (Linky) --->'Status':'302'
2018-04-05 23:08:56.693  (Linky) --->'Headers (12):
2018-04-05 23:08:56.693  (Linky) ------->'Date':'Thu, 05 Apr 2018 21:08:56 GMT'
2018-04-05 23:08:56.693  (Linky) ------->'Server':'Apache'
2018-04-05 23:08:56.693  (Linky) ------->'Set-Cookie':'AMAuthCookie=LOGOUT; Domain=.enedis.fr; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/'
2018-04-05 23:08:56.693  (Linky) ------->'Cache-Control':'private'
2018-04-05 23:08:56.693  (Linky) ------->'Pragma':'no-cache'
2018-04-05 23:08:56.693  (Linky) ------->'AM_CLIENT_TYPE':'genericHTML'
2018-04-05 23:08:56.693  (Linky) ------->'X-AuthErrorCode':'0'
2018-04-05 23:08:56.693  (Linky) ------->'Location':'https://espace-client-particuliers.erdf.fr'
2018-04-05 23:08:56.693  (Linky) ------->'Content-Length':'0'
2018-04-05 23:08:56.694  (Linky) ------->'Keep-Alive':'timeout=5, max=300'
2018-04-05 23:08:56.694  (Linky) ------->'Connection':'Keep-Alive'
2018-04-05 23:08:56.694  (Linky) ------->'Content-Type':'text/plain'
Barberousse
Posts: 140
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Getting cookie with python framework

Post by Barberousse »

I found the problem and pushed a PR: https://github.com/domoticz/domoticz/pull/2301
linkrk01
Posts: 1
Joined: Tuesday 03 October 2017 9:31
Target OS: -
Domoticz version:
Contact:

Re: Getting cookie with python framework

Post by linkrk01 »

Design, manufacture and sales of all types of satellite-based "Azangoo" devices and related products.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest