Uh, I'm naming it `upcoming' so I guess there is a minor conflict with Jay's module. But it's really cool, I swear. And it is a full package with a setup.py and documentation and examples and all that.
Impatient people: http://an9.org/files/upcoming-0.1.tar.gz or in svn
It works along a bit of a different premise than Jay's module, the goal with this was to be as kind of developers as possible, making them do the least amount of work to get to information and making the data easy to represent in different ways. Oh, and it's dead easy to extend. Like, you can do it, really you can easy.
In order to do this, the API is provided via a few avenues, for example all three of the following examples return list of events for San Francisco:
import upcoming
The standard "load an API instance and make a call" method, with the added bonus of looking pretty when you type it
a = upcoming.api() events = a.event.search(metro_id=2)
The "I've already got the object, let it do the thinking" method
sf = upcoming.Metro(id=2) events = sf.events()
And the "why load more" method (if the quick_api configuration variable is enabled)
events = upcoming.event.search(metro_id=2)
Just to spice up the soup a bit, one of the sample scripts will output a list of events happening during the upcoming weekend (or until the end of the current weekend if you are already in one). It grabs events for the metros you specify in your local configuration file; once you have upcoming.py installed just run scripts/this_weekend
Oh, and here's a dump of the README.txt
UH... WHAT?
It's a module to wrap the API provided at Upcoming.org, details available at: http://upcoming.org/services/api
Seems to cover everything.
Oh, this module was mostly hacked out of my Flickr API module, so it has some extra stuff. Eventually I'll make a "universal api"... yeah.
INSTALL NOTES
After you run the setup.py you'll want to configure. It mentions that though, so you can read it then.
If you have installed PyXML it should parse a bit faster (I think), otherwise it just uses xml.dom.minidom
USAGE
See EXAMPLES
The code is fairly readable once you get down to the section called Models, I'd suggest seeking down to --MODELS-- once you open that file. The hope is that anything you expect to be there probably is and probably works how you expect it to work. Big dreams...
EXAMPLES
Sample scripts are located in the `scripts' directory Typical usage would look something like this:
import upcoming # initialize the api api = upcoming.api() # events will be a list of Event instances events = api.event.search(metro_id=2,search_text="SuperHappyDevHouse") # objects can be initialized specifically as well sf = upcoming.Metro(id=2) # this will call the api to retrieve the venues for this metro's id # returning a list of Venue instances venues = sf.venues() # Any extra arguments passed to the relational calls will be passed # straight on to the api call sf_events_today = sf.events(min_date="2005-05-24") # "Quick API" # This is available if the quick_api configuration variable is true # theoretically it saves memory or something not to load it, but I # didn't check so it probably doesn't do anything useful. sf_events = upcoming.event.search(metro_id=2)NOTES
The scripts assume a utf-8 compatible terminal, hack the code if that doesn't apply to you.
BUGS
Email me with whatever you find, I'll do my best to keep this maintained if people are using it.
Contact info: ---------------------- or check my wiki page: http://an9.org/w/AndySmith
AUTHOR
Andy Smith ... http://an9.org/w/AndySmith