System Downtime

March 2, 2009

Developing a Python WordPress library

Filed under: Programming — Tags: , , , — Michael Pobega @ 12:38 PM

As an introduction to programming I decided to divulge into a full-fledged project, instead of working on smaller programs. Considering the lack of a good Python WordPress library I decided to combine the features of two separate programs (Vimpress [http://www.vim.org/scripts/script.php?script_id=1953] and a WordPresslib [http://www.blackbirdblog.it/programmazione/progetti/28]) and XML-RPC to create a full-scale WordPress-compatible library and client for Python.
Currently I’m converting these two functional (by that I mean function based as opposed to object oriented) libraries to one complete objective library. I’m still at the beginning steps, defining classes and functions, but it’s functional to the point of being able to post! (see previous blog entry)

December 21, 2008

Wget and Post Data

Filed under: Programming, Scripting — Tags: , , , , — Michael Pobega @ 4:41 PM

I had an idea for a script to automatically log me in to Advance Wars by Web and grab the number of games which it is my turn in, but Wget seems to have a lot of trouble with post-data and cookies while accessing pages. Currently, this is how my script looks:

#! /bin/sh
# Script for grabbing “Your Turn Games” from AWBW (http://awbw.amarriner.com)
# Written and maintained by Michael Pobega
# Special thanks to the GNU Wget manpage for help with cookie sessions

wget –keep-session-cookies –save-cookies cookies.txt –post-data ‘username=pobega&password=PASSWORD’ –keep-session-cookies http://awbw.amarriner.com/login.php

wget –load-cookies cookies.txt
http://awbw.amarriner.com/yourturn.php

Every time I’d login to the page, the downloaded yourturn.php would complain that I was not logged in. I’m going to mess around with this script a little more and hopefully find the problem.

Edit: Nevermind, I found the problem. I guess I’m a bit blind, but it’s right in the wget(1) manpage:

If the server is using session cookies to track user authentication, the above will not work because –save-cookies will not save them (and neither will browsers) and the cookies.txt file will be empty. In that case use –keep-session-cookies along with –save-cookies to force saving of session cookies.

Create a free website or blog at WordPress.com.