login - Python: Trouble logging into this website via Requests Library -
can me take why cannot log website?
the website i'm trying log is: http://boxrec.com/en/login
here's code looks like:
import re import requests bs4 import beautifulsoup payload = { 'username': 'username101', 'password': 'password101' } requests.session() s: test = s.post('http://boxrec.com/en/login', data=payload) r = s.get('http://boxrec.com/en/schedule') soup = beautifulsoup(r.content) print(soup) when call test.cookies, i'm not getting cookie jar i'm assuming login failed.
another way know did not log in part of websites require user-login view information. after tried logging in, went part of website web-scrap information , see they're missing because i'm not logged in.
are keys dictionary correct? can see website names username box '_username' name , 'username' id. can me confirm keys i'm using correct?
also, need care remember me @ all? tried passing in true in dictionary still no luck. there easy way can know parameters needed login?
thanks in advanced!
the form data on page lists field names as:
_target_path: '', _username: '', _password: '', login[go]: '' try changing dictionary keys "username" "password" "_username" "_password".
i created test account , able login using code below.
from requests import session uname = 'zacktest' password = 'password1' site = 'http://boxrec.com/en/login' payload = { '_username': uname, '_password': password } session() s: s.get(site) p = s.post(site, data=payload) print(p.text)
Comments
Post a Comment