Sha256: 27572b65d2d20b4423a9ad322ba1faad967d709d0b9a1dea4b73c5cbd6b306e3
Contents?: true
Size: 1.14 KB
Versions: 12
Compression:
Stored size: 1.14 KB
Contents
#! /usr/bin/python # # wdput - Send one Wikidot page to api.zero.mq # Part of the ztools/apisite toolkit. Install into any directory on PATH. # # Author: Pieter Hintjens <ph@imatix.com> # License: public domain # # syntax: wdput sitename category page title # # Wikidot text must be in page + '.wd' # # Supply your Wikidot user name as an environment variable APISITE_USER # Supply your Wikidot API key as an environment variable APISITE_KEY # Get script arguments import sys sitename = sys.argv [1] category = sys.argv [2] name = sys.argv [3] title = sys.argv [4] # Get authentication credentials import os user = os.environ ['APISITE_USER'] key = os.environ ['APISITE_KEY'] # Create XML/RPC connection to Wikidot from xmlrpclib import ServerProxy server = ServerProxy ('https://' + user + ':' + key + '@www.wikidot.com/xml-rpc-api.php') # Send page content (create or update) file = open (name + ".wd", "r") content = "" for line in file: content = content + line print " - " + category + ":" + name server.pages.save_one ({ "site": sitename, "page": category + ":" + name, "title": title, "content": content})
Version data entries
12 entries across 12 versions & 2 rubygems