Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
from wordpress_xmlrpc import Client
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc import Client, WordPressPost
from slugify import slugify
import requests
import os.path
from bs4 import BeautifulSoup
client = Client('', 'xmlrpc', 'password')
def getPage(url, filename):
if filename == '':
print "No File Name"
c = ''
if os.path.isfile('pages/'+filename):
print("Loading the data via the file.")
f = open('pages/'+filename, 'r')
c =
print("Fetching the data via the URL.")
result = requests.get(url)
c = result.content
f = open('pages/'+filename,'w')
c = BeautifulSoup(c)
return c
html = getPage("", "page1.html")
rows ='#hnmain > tr:nth-of-type(3) > td > table > tr');
for row in rows:
link ='td:nth-of-type(3) a')
print link[0].text
post = WordPressPost()
post.title = link[0].text
post.post_type = "post"
post.content = link[0].get('href')
post.post_status = "publish"
addpost =