PyMongo 1.7 and MasterSlaveConnection – TypeError breakage

MasterSlaveConnection: Works in Pymongo 1.6 In my previous article Python, MongoDB and Pylons – Connection handles and all that lark I described the code and configuration we use at Snaptic for working with Pylons and MongoDB. We use the MasterSlaveConnection class to automatically handle read/write splitting, because we expect to be running a single master/multiple [...]

Python, MongoDB and Pylons – Connection handles and all that lark

I’ve been doing a bunch of hacking with Pylons and MongoDB recently for some backend stuff at Snaptic. Right now we are using Paster as the webserver and the Pymongo driver. This all works fine and is pretty straightforward to set up – but there are a couple of subtleties. MongoDB vs SQLAlchemy If you’ve [...]

Autocomplete with Python, Pylons, SQLAlchemy and jQuery

Recently I needed to implement my own autocomplete for a project on snagmachine.com. We had a large database of products and wanted to ease data entry by hinting to the user via autocomplete when possible. In future, we can probably just use Freebase Suggest but right now we needed our own solution. The Pieces Autocomplete [...]

Pylons tip #5 – Streaming static files

Pylons makes it super easy to return data to a client. You just return a string from your controller method! class HelloController(BaseController):   def index(self): return ‘Hello World!’ Very nice. However, what if you want to serve up a potentially quite large file to the client? Sure, you could read the file into memory, and [...]

Simple Python Twitter Search API Crawler Class

I’ve been getting into Twitter (I’m @niallohiggins btw) a bit recently. One of the things I wanted to do was write a little program to periodically search for a specific tag and then process the results. The Twitter Search API is very easy to use, even if there are some annoying issues. Here is a [...]