I can login to blogger with my email, but I don't know how to create a new blog. I tried many ways but it did not works.
Here is login code:
Code: Alles auswählen
# coding: utf-8
import requests
from bs4 import BeautifulSoup
class SessionGoogle:
def __init__(self, url_login, url_auth, login, pwd):
self.ses = requests.session()
login_html = self.ses.get(url_login)
soup_login = BeautifulSoup(login_html.content).find('form').find_all('input')
dico = {}
for u in soup_login:
if u.has_attr('value'):
dico[u['name']] = u['value']
# override the inputs with out login and pwd:
dico['Email'] = login
dico['Passwd'] = pwd
self.ses.post(url_auth, data=dico)
def get(self, URL):
return self.ses.get(URL).text
url_login = "https://accounts.google.com/ServiceLogin"
url_auth = "https://accounts.google.com/ServiceLoginAuth"
session = SessionGoogle(url_login, url_auth, "myemail@gmail.com", "mypassw")
print session.get("https://www.blogger.com/home")