Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Grab the latest version number of a plugin from the Wordpress plugin API.
# Alex Rydzak - <>
# import necessary libraries
import requests
# set plugin name (usually something-something- no extension on the end)
plugin = "akismet"
# hit the Wordpress plugin information API for our plugin
wpquery = "" % (plugin)
result = requests.get(wpquery)
# if the query was sucessful...
if str("200") in str(result):
print "[*] Request to Wordpress API worked..."
# grab the first line of the result from the query
grabfirst = result.content.splitlines()[0]
# split the returned string on the " character
grabcell = grabfirst.split('"')
# print the plugin version
print "[*] Latest plugin version for %s: %s" % (plugin,grabcell[13])
print "[*] Something bad happened. Maybe you didn't spell the plugin name right?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.