Questions tagged [cookiejar]

Cookiejar is a Class from the cookielib Python module

The cookielib module defines classes for handling of HTTP cookies.

73 questions
45
votes
5 answers

Go HTTP Post and use Cookies

I'm trying to use Go to log into a website and store the cookies for later use. Could you give example code for posting a form, storing the cookies, and accessing another page using the cookies? I think I might need to make a Client to store the…
Lionel
  • 3,188
  • 5
  • 27
  • 40
33
votes
4 answers

Get cookie from CookieJar by name

I know that I can iterate through the cookies in a cookiejar, and this would allow me to find a cookie with a particular name - but does the CookieJar object itself have any methods I can call to get a certain cookie by name? It just saves me having…
Matt
  • 11,157
  • 26
  • 81
  • 110
19
votes
1 answer

The difference between HttpCookie and Cookie?

So I'm confused as msdn and other tutorials tell me to use HttpCookies to add cookies via Response.Cookies.Add(cookie). But that's the problem. Response.Cookies.Add only accepts Cookies and not HttpCookies and I get this error: cannot convert from…
Gio
  • 555
  • 2
  • 5
  • 7
14
votes
1 answer

How can I add a cookie to an existing cookielib CookieJar instance in Python?

I have a CookieJar that's being used with Mechanize that I want to add a cookie to. How can I go about doing this? make_cookie() and set_cookie() weren't clear enough for me. br = mechanize.Browser() cj =…
Paul
  • 519
  • 1
  • 4
  • 6
12
votes
4 answers

Why php curl does not save cookie in my cookiefile?

I'm trying to save a cookie in the curl cookiejar. I've simplified my code but its not working.
kasper Taeymans
  • 6,950
  • 5
  • 32
  • 51
9
votes
2 answers

How to pickle a CookieJar?

I have an object with a CookieJar that I want to pickle. However as you all probably know, pickle chokes on objects that contain lock objects. And for some horrible reason, a CookieJar has a lock object. from cPickle import dumps from cookielib…
Unknown
  • 45,913
  • 27
  • 138
  • 182
8
votes
1 answer

TypeError: str.trim is not a function (Request-Promise/Tough-Cookie)

I am having similar problem as discussed here: https://github.com/request/request-promise/issues/183 I am using Request-Promise@4.2.2 and Tough-Cookie@2.3.4 And getting the same error: TypeError: str.trim is not a function I also played around…
7
votes
1 answer

Empty cookiejar using SUDS

I'm running SUDS 0.4 on Linux Slackware 13.0 with python 2.6.2. When I call SOAP method using this code: from suds.client import Client client = Client(url='file:acctWeb.wsdl', location='http://10.242.69.4:8088/pfmaccess') res =…
rjan
  • 71
  • 4
6
votes
1 answer

Handling Cookies in Flutter

I want to make a new flutter application, I'm using the Facebook Login SDK (for flutter). The login was succefully implemented and I am able to get the accesstoken and the UID of the connected user. My problem is, when the user logs in, I want to…
6
votes
4 answers

httplib2, how to set more than one cookie?

As you are probably aware, more often than not, an HTTP server will send more than just a session_id cookie; however, httplib2 handles cookies with a dictionary, like this: response, content = http.request(url, 'GET', headers=headers) headers =…
user168833
  • 167
  • 2
  • 8
4
votes
2 answers

Python CookieJar saves cookie, but doesn't send it to website

I am trying to login to website using urllib2 and cookiejar. It saves the session id, but when I try to open another link, which requires authentication it says that I am not logged in. What am I doing wrong? Here's the code, which fails for…
Tom Ray
  • 133
  • 3
  • 11
4
votes
1 answer

Use Golang to login to private site and pull info

I try to use golang to login in a private area of a website and pull some info, but i don't quite seem to get it right. I manage to fetch the login page to get the csrf token, then i post the csrf token together with the login info to the login page…
Twisted1919
  • 2,430
  • 1
  • 19
  • 30
4
votes
3 answers

requests.Session() load cookies from CookieJar

How can I load a CookieJar to a new requests.Session object? cj = cookielib.MozillaCookieJar("mycookies.txt") s = requests.Session() This is what I create, now the session will store cookies, but I want it to have my cookies from the file (The…
Ranama
  • 131
  • 1
  • 3
  • 10
4
votes
1 answer

Struggling to retrieve csrf token from a cookiejar object

I am using the code below based on this answer to store authentication cookies in a file. This allows me to avoid having to log in every time I run the program. Now, fetching the csrftoken from regular Session cookies works well, but when I try to…
octosquidopus
  • 3,517
  • 8
  • 35
  • 53
4
votes
0 answers

Using mechanize in python does not seem to be working correctly for POST requests. (400 Error)

I am coding an IRC bot in Python in order for my friends and I to buy items from the steam market. It is mostly for fun and to advance my programming skills. I have been able to get the lowest price for an item, but I am having trouble POSTing the…
Ekansh Vinaik
  • 141
  • 2
  • 4
1
2 3 4 5