Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Requests problem
#1
Hi,
I'm trying to connect to a website with requests library.
This is my code :

import requests url = 'http://www.website.com' values = { 'loginForm': 'loginForm', 'loginForm:login': '', 'loginForm:password': '', 'loginForm:submit': 'Valider', 'javax.faces.ViewState': 'j_id2' } with requests.Session() as s: response = s.post(url, data=values) print(response.text)
When i'm executing this one, it will redirect me at the same page, login form. I don't know why.
Did I forgot something ?

Here are informations I sent when I submit form.

[Image: 180522100614516744.png]

Thanks for your help Sad
Reply
#2
It deepens on what login needs,it can vary on different web-sites.
Now you only send form values,it may need some header data and maybe also Cookies.
Look at this post there did i inspect the web-site.
He respond was that it did work.
Reply
#3
On safe forms you have a hidden variable, which should be sent together with the post request.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
(May-22-2018, 11:12 AM)snippsat Wrote: It deepens on what login needs,it can vary on different web-sites.
Now you only send form values,it may need some header data and maybe also Cookies.
Look at this post there did i inspect the web-site.
He respond was that it did work.

It works sorry for the duplicate.
Thank you for your help ! ;)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  'import requests' problem Curbie 2 1,401 Aug-14-2024, 01:04 AM
Last Post: Curbie
  Import requests/beautifulsoup problem Jokadaro_ 3 3,999 Dec-05-2021, 01:22 PM
Last Post: Jokadaro_
  Problem in DB requests using if()s nikos 4 4,280 Feb-09-2019, 11:52 PM
Last Post: nikos

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.