2017-10-03 33 views
1

何度もリクエスト投稿機能を使用しています。私は理由を知りませんが、今私は1つのWebサイトにログインすることはできません:私がしようとすると、その後リクエストでのログイン投稿

# Import 
from requests import Session 
from bs4 import BeautifulSoup 


# Core settings 
HEADERS = { 
    "User-Agent": "Mozilla/5.0"} 

s = Session() 
response = s.get("https://suite.searchmetrics.com/en/auth/login", headers=HEADERS) 
soup = BeautifulSoup(response.text, "lxml") 
redirect_url = soup.select('input[id="id_redirect_data"]')[0].get("value") 
data = {"redirect_url": redirect_url, 
     "mail": "[email protected]", 
     "password": "abcfeFD"} 
s.post("https://suite.searchmetrics.com/en/auth/authenticate", data=data, headers=HEADERS) 

content_url = "https://suite.searchmetrics.com/en/research?url=wsj.com" 
response = s.get(content_url, headers=HEADERS) 
soup1 = BeautifulSoup(response.text, "lxml") 
print(soup1.prettify()) 

私は

+1

あなたが '' –

+0

を「/ EN /認証/認証」するためにあなたのデータを提出しなければならない私はsuite.searchmetrics.com/en/auth/authenticateするためにそれを変更しましたが、それは私の作品 – edyvedy13

+2

を動作するようには思えません。投稿を現在のコードで更新できますか? –

答えて

0
をhighchartに属するハッシュタグを見つけることができません

redirect_urlを定義しているのに気付きましたが、実際には使用していません。 redirect_nameは使用しますが、どこにも定義しません。それはあなたの問題だろうか?

+0

実際には、私はちょうどコードを短縮し、今編集しました – edyvedy13

関連する問題