Archive for the ‘python’ Category

feedextractor - a quick and dirty python script to grab lots of feeds from web pages

Monday, February 4th, 2008 | 2 Comments

While looking for new feeds to add to my RSS reader (NetNewsWire), I thought it might be nice to have a utility that would let me grab a web page, spider all of the outbound links, check to see which pages had feeds, and then create an opml file of new feeds I didn’t have [...]

Continue reading »

httpd anywhere - A simple python script to quickly run a web server using any directory as the root

Saturday, October 6th, 2007 | No Comments

I develop a lot of little sites for fun. Sometimes I’m trying out an idea or I just want to test some CSS or Javascript, etc. In any case, I find it useful in testing to have a web server that can fire off from any directory on my machine.
Python just happens to [...]

Continue reading »

Using httplib.HTTPConnection.set_debuglevel() with urllib2

Monday, October 1st, 2007 | 2 Comments

I’ve been trying to get the debug level turned on in urllib2 for about an hour and now that it is working I thought I would post what I found…
When using urllib, you can set the debuglevel directly by using something like this:

import urllib, httplib
httplib.HTTPConnection.debuglevel = 1
urllib.urlopen(”http://www.somesite.com”)

However, when using urllib2 you need to [...]

Continue reading »

Basic SQLAlchemy ORM Example

Friday, September 21st, 2007 | No Comments

If you are not into DB-API, SQLAlchemy may be for you.
SQLAlchemy is a database “toolkit” for python. In many ways, it is like Hibernate from the Java world. Both kits are focused on providing high-performance object relational mapping, but they also provide some nice database abstraction functions as well. The SQLAlchemy document [...]

Continue reading »

Simple MySQL Python Example

Friday, September 21st, 2007 | No Comments

In order to use MySQL with python, you need to get the MySQLdb up and running. Once you have that installed, you use the DB-API to perform queries and such.
The DB-API PEP is good if you already know what you’re doing (you can also look at the sqlite module doc). Below is my [...]

Continue reading »