Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
Unable To Login To Webpage Using Python Requests
Post Body

Hello Friends!

I am trying to programmatically login to a website using Python Requests module (using latest versions of both requests and python at the time of writing). No matter what I try, it just doesn't seem to work. I am not getting any error message too.

Below is the code I have for reference.

import requests

# The url to login
URL = '<my url>'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0'
}

# These are private proxies
proxies = {
    'http': 'http://username:password@url:port',
    'https': 'https://username:password@url:port'
}

# Specify the email and password here
data = {
    'inputs-newEmail': '<my email_id>',
    'password': '<my password>'
}

with requests.Session() as session:
    try:
        post = session.post(
            url=URL,
            headers=headers,
            proxies=proxies,
            data=data
        )
        print(post.raise_for_status())  # Always returns None
    except Exception as e:
        print(e)

Below is the form details from the website I am trying to submit the post request. I notice that form and the div has an ID tag and it changes every time the page is refreshed. I don't know if this is causing any kind of problem.

https://imgur.com/a/63Pz07f

I have even tried selenium but the send_keys commands do not send anything to the email and password fields.

This is the first time I am trying a post request like this and I am not sure what I am doing wrong. Kindly guide me.

Author
User Disabled
Account Strength
0%
Disabled 4 months ago
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,531
Link Karma
663
Comment Karma
5,737
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago