Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from shlex import split
- import requests
- from bs4 import BeautifulSoup
- import re
- import mechanize
- import urllib
- with open("Myaccount.txt") as f:
- for line in f:
- parts = line.split(':')
- print parts[0]
- br = mechanize.Browser()
- br.set_handle_robots(False)
- br.addheaders = [("User-agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36")]
- sign_in = br.open("https://website.com/login/")
- br.select_form(nr = 0)
- br["username"] = parts[0]
- br["password"] = parts[1]
- logged_in = br.submit()
- logincheck = logged_in.read()
- print "logincheck"
- cookies = br._ua_handlers['_cookies'].cookiejar
- payload = {'action':'info',
- 'action':'info',
- 'api_key':'something'
- }
- with open("cookie.txt", "w") as text_file:
- text_file.write("%s" % cookies)
- payload = {'action':'info',
- 'action':'info',
- 'api_key':'something'
- }
- text_file.close()
- with open("cookie.txt", "r") as text_file:
- for line in text_file:
- yup = line
- payload = {'action':'info',
- 'action':'info',
- 'api_key':'something'
- }
- print yup
- r = requests.post("https://website.com",data = payload, cookies =yup)
Add Comment
Please, Sign In to add comment