尝试登录到revers.it python

时间:2017-07-25 08:52:08

标签: python session-cookies

我想登录https://www.reverse.it但没有成功(我每次都得到403) 这是我的一次尝试:

#base_url = 'https://www.reverse.it/recent-submissions?filter=file'
base_url = 'https://www.reverse.it'
Login_url = 'https://www.reverse.it/login'
username = 'mymail@gmail.com'
password = 'mypassword'

session = requests.Session()
headers = {'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) " 
+ "Gecko/20100101 Firefox/41.0"}


# print session.cookies.get_dict()

def request_to_soup(url):
req = session.get(url, headers=headers)
soup = BeautifulSoup(req.content, "html.parser")
return soup


soup = request_to_soup(base_url + '/login')
print soup

from requests.auth import HTTPBasicAuth
requests.get(Login_url, auth=HTTPBasicAuth(username, password))





 #login_request = session.post(Login_url, data=payload, headers=headers)

这是我试过的方法之一(我创造了)

  #    'username': (username),
  #    'password' : (password)
 print "******************************************************************************
     ********"
# print session.cookies.get_dict()

cookies = dict(cookies_are='working')
r = requests.get(Login_url, cookies=cookies)
print r

我得<Response [403]> 每次 我做错了什么?

0 个答案:

没有答案