Commit 640a2de6 authored by Anastasia Galkin's avatar Anastasia Galkin
Browse files

check wordpress instances for new posts, users, pages, in progress

parents
#!/usr/bin/python
import MySQLdb
import settings
# Open database connection
db = MySQLdb.connect(WORDPRESS_DATABASES["localhost","testuser","test123","TESTDB" )
# prepare a cursor object using cursor() method
cursor = db.cursor()
# execute SQL query using execute() method.
# check for new posts,
query_count_posts = "select count(*) from wp_posts where post_type like 'post'"
cursor.execute(query_count_posts)
# Fetch a single row using fetchone() method.
data = cursor.fetchone()
print "Database version : %s " % data
# disconnect from server
db.close()
\ No newline at end of file
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': '',
# 'USER': '',
# 'PASSWORD': '',
# 'HOST': '',
# 'PORT': '',
# }
# }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment