0

My goal is to extract some information from the site every now and then automatically. To be able to do that I have to be logged in and I can't find a way to pass my credentials to the website.

import requests

EMAIL = 'randomemail@gmail.com'
PASSWORD = 'randompassword'
URL = 'https://www.myanonamouse.net'

def main():
    session = requests.Session()
    login_data = {
        'email': EMAIL,
        'password': PASSWORD,
        'submit': 'Log in!',
    }


    r = session.post(URL, data=login_data)
    print(r.text)
main()

I need some help fixing this part, but I would also like to know what I did wrong and how I can improve it (stay logged in for the entire session). Thanks in advance.

  • 1
    I suggest you to use `selenium webdriver` for this.Just google and you will find tutorials. Meanwhile here is an example from [SO](https://stackoverflow.com/a/21186465/3091398) – CodeIt Dec 16 '18 at 08:55
  • 1
    If you want to start from what you have here, you need to use POST instead of GET. You’ll easily find tutorials on the web. – Jim Danner Dec 16 '18 at 09:21
  • You should read the HTML of the site and see which method is used for authentication, which data should be passed, which URI should be accessed – ForceBru Dec 16 '18 at 09:40
  • @ForceBru I am not really sure at what I should look for. Could you link to me some stuff or write a small explanation? Thanks – user10796883 Dec 16 '18 at 10:41

0 Answers0