1

I'm trying to authenticate on a website using python requests.

I use a Chrome extension named cookie.txt to save the cookies file from a Chrome session on the website I want to authenticate on.

When I use following wget command

wget -O hp.html -x --load-cookies cookies.txt http://www.thewebsite.com

It works: I get the webpage with authenticated content

But when I try to do the same thing using Python Requests package with

import cookielib
import requests

cj = cookielib.MozillaCookieJar('cookies.txt')
cj.load()

url = 'http://www.thewebsite.com'
r = requests.get(url, cookies=cj)

I get an error 400 status

Is there something I'm doing wrong ?

SergGr
  • 23,570
  • 2
  • 30
  • 51
Jerry
  • 61
  • 4

0 Answers0