Archive for the ‘python’ Category

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

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 [...]

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

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 [...]

Using httplib.HTTPConnection.set_debuglevel() with urllib2

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 [...]

Basic SQLAlchemy ORM Example

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 [...]

Simple MySQL Python Example

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 [...]