how to create a new blogspot using python

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
wichita12
User
Beiträge: 1
Registriert: Sonntag 22. Mai 2016, 18:05

Hi,

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")
Thanks for helping.
Zuletzt geändert von Anonymous am Sonntag 22. Mai 2016, 18:48, insgesamt 1-mal geändert.
Grund: Quelltext in Python-Codebox-Tags gesetzt.
Antworten