Questions tagged [cookiejar]

Cookiejar is a Class from the cookielib Python module

The cookielib module defines classes for handling of HTTP cookies.

73 questions
2
votes
1 answer

Scrape Amazon Seller Central

i'm trying to access the Amazon Seller Central through python and Mechanize. This is my code, i think it's working, but when i check a page that is only accessible of you login, it get redirected to a page that says: "to continue using Amazon,…
2
votes
2 answers

Curl output cookie jar contents to clipboard

I'm using Curl on a site that returns the cookie upon login. In the command line (cygwin) I'd like to output the cookie data to the clipboard. Typically I would use > /dev/clipboard at the end of the command but that doesn't seem to work for the…
user2029890
  • 2,493
  • 6
  • 34
  • 65
2
votes
2 answers

Python authenticate and launch private page using webbrowser, urllib and CookieJar

I want to login with cookiejar and and launch not the login page but a page that can only be seen after authenticated. I know mechanize does that but besides not working for me now, I rather do this without it. Now I have, import urllib, urllib2,…
user1552586
2
votes
2 answers

Fake a cookie to scrape a site in python

The site that I'm trying to scrape uses js to create a cookie. What I was thinking was that I can create a cookie in python and then use that cookie to scrape the site. However, I don't know any way of doing that. Does anybody have any ideas?
John Jiang
  • 11,069
  • 12
  • 51
  • 60
2
votes
4 answers

Retrieve cookie created using javascript in python

I've had a look at many tutorials regarding cookiejar, but my problem is that the webpage that i want to scape creates the cookie using javascript and I can't seem to retrieve the cookie. Does anybody have a solution to this problem?
John Jiang
  • 11,069
  • 12
  • 51
  • 60
2
votes
1 answer

Met HTTP Error 400: Bad Request when using mechanize in python

I met a problem when I using mechanize in Python, look my codes first: >>> s 'http://www.renren.com' >>> br=mechanize.Browser() >>> br.open(s)
Simon
  • 63
  • 6
1
vote
1 answer

How to remove `#HttpOnly_` prefix before MozillaCookieJar load cookies.txt?

I use Firefox's extension (cookies.txt) export cookies.txt for python script. And there is some HttpOnly cookie begins with "#HttpOnly_" was ignored in MozillaCookieJar, just like a comment, e.g.: #HttpOnly_.sample.com TRUE / FALSE …
somggx
  • 43
  • 6
1
vote
0 answers

Setting expires date cookies via CookieManager but webview not apply it

I have a problem. I'm sending request for getting cookies from url. This url has link which return image. But cookies return expire date time for not to showing image some time. I'm applying this cookies to CookieManager and after I'm loading this…
Slava
  • 443
  • 4
  • 12
1
vote
1 answer

Python HTTP cookie jar implementation in aiohttp

I'm trying to implement the logic from the piece of code below which does requests to google search using aiohttp, my solution seems to be equivalent but for some reason does not set cookies as desired. Any help? from http.cookiejar import…
Jake
  • 330
  • 1
  • 3
  • 16
1
vote
1 answer

Why is it so difficult to add a cookie to an http cookiejar in python? I always end up with CookieError: Attempt to set a reserved key 'domain'

I have read all the questions I could find relating to this topic but none were helpful and/or relevant. I am using playwright with Asyncio and aiohttp to automate some web based tasks. Part of that workflow involves getting and re-using cookies. I…
ruderoy
  • 33
  • 4
1
vote
1 answer

How to fix AttributeError: type object 'CookieJar' has no attribute 'LWPCookieJar'?

I am using cookielib(cookiejar named now in Python3) and mechanize. I am importing this way import requests from bs4 import BeautifulSoup import mechanize try: from cookielib import Cookie, CookieJar except ImportError: from…
limitcracker
  • 2,208
  • 3
  • 24
  • 23
1
vote
1 answer

Delete cookies / end session using cookiejar

I have written a python script fetching a State of Health web page from some hardware we are using. Looking into the HTML and javascript files, it was relatively easy to fetch what I wanted. The problem is that I am not able to end the session and…
MortenSickel
  • 2,118
  • 4
  • 26
  • 44
1
vote
1 answer

Python requests invalid header value

I have exported a cookies.txt file from firefox using a cookie export addon. Im trying to use the cookie file with python requests but getting this... ValueError: Invalid header value My code: import requests cj =…
1
vote
1 answer

Cookie policy getting ignored?

I'm trying to use requests.Session to make some requests and I'd like cookies to not be set. Looking at this question, it appears I can create a cookie policy, and create a cookie jar given that policy to ignore cookies. However, for my requests, it…
1
vote
0 answers

Logging into Facebook with Python 3.x and getting a 'login successful message'?

I'm a longtime viewer and first-time asker here at stackoverflow, so excuse me for my newbieness. I've been struggling with something for the past 2 hours now, looked up several questions like this but none really helped me with this problem. What…