2016-08-18 112 views
-1

我正在使用Python請求製作API,而HTTP GET工作正常,但我在HTTP POST方面遇到了一些問題。因此,與許多網站一樣,您可以閱讀信息,但爲了發佈帖子請求(例如關注用戶或撰寫帖子),您需要擁有經過驗證的會話。這個網站使用google進行登錄。通常,我只需將用戶名:密碼輸入到POST請求formdata中即可登錄,但這個谷歌的東西非常不可靠(坦率地說,我沒那麼有經驗)。有沒有人有一個參考或例子來幫助我? ;/如何通過python請求登錄Google?

+0

查看'selenium'。 http://stackoverflow.com/questions/33708821/auto-connect-on-my-gmail-account-with-python-selenium –

+0

你需要分享網站的網址 –

回答

-2

我不知道蟒蛇請求,但以發送電子郵件的那麼容易,因爲這

import yagmail 
yagmail.SMTP(emailh).send(email, subject, body) 

#emailh = your email (just username no @gmail.com) 
#email = send to (full email including domain ***@gmail.com or ***@outlook.com) 
#subject = subject of the message 
#body = body of the message 

更妙

emailh = raw_input('Your email: ') 
    email = raw_input('Send to: ') 
    subject = raw_input('Subject: ') 
    body = raw_input('Body: ') 
    yagmail.SMTP(emailh).send(email, subject, body) 
    print('Email Sent.') 

如果這是你無論如何不會說什麼。

此頁面可能有用link