Python Requests And Proxies

One of Requests’ most popular features is its simple proxying support. HTTP as a protocol has very well-defined semantics for dealing with proxies, and this has lead to widespread deployment of HTTP proxies. The vast majority of these proxies are ‘transparent’: that is, they sit on the message path and quietly capture HTTP messages before […]

Read More

Big Redesign Time

I first posted in this blog 14 months ago. In the history of humanity, that’s not all that long ago, but for me it feels like an age. When I wrote that original blog post, I was still at university (just). I knew I was going to be a software engineer, but didn’t have much […]

Read More

Pillow 2-1-0 is Out

Pillow is a popular fork of PIL by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors Pillow 2.1.0 is out! With this release, the Pillow team has finally removed support for “import _imaging”, thus completing the move of PIL modules into the PIL namespace [1]. Many thanks to […]

Read More

Heroku Buildpack for Numpy, Scipy and Scikit-Learn

(TLDR: https://github.com/dbrgn/heroku-buildpack-python-sklearn) Background At Webrepublic we just launched a Python based system that among other things does comparison of large texts using tf-idf vectors in a multi-dimensional vector space and measuring the cosine similarity between them (see http://stackoverflow.com/a/8897648/284318). For this, we needed scikit-learn. During the deployment process, I discovered that one does not simply deploy […]

Read More

IPython Notebook

Last PyCon US (2013) I attended, there were many interesting talks, but if I had to talk about what’s happening, what’s the trend, between other things I would mention IPython Notebook. In a few words: it’s an excellent tool, you can have an IPython console within your web browser where you can write code snippets […]

Read More

Using Jedi with YouCompleteMe

(In case you’re not familiar with it yet, Jedi is an awesome autocompletion library for Python that tries to understand your code. There are editor plugins available for Vim, Emacs and Sublime Text 2.) The “official” Jedi plugin for vim is jedi-vim, but there’s another vim autocompletion plugin that supports Jedi: YouCompleteMe. In contrast to […]

Read More

Caching In Python Requests

I think I’ve made it clear in the past that I think Requests is awesome. At this stage it’s become a mature, feature-filled library that is more than capable of replacing urllib2 and friends in almost every situation you might be interested in. There are very few things that urllib2 can do that Requests can’t […]

Read More

Enums in Python

Until now, if you wanted to use enumeration types in Python you had to fall back to a class-attribute approach: >>> class Color(object): … RED = 1 … GREEN = 2 … BLUE = 3 … >>> print(Color.RED) 1 This has different downsides, for example with representation (Color.RED is represented as an integer, not as […]

Read More

New Pyramid Site

For the first time in 10 years, http://aclark.net is not powered by Plone. Nothing against Plone: it’s still one of the greatest loves of my life (inasmuch as you can love a software and community, as I do). Why This was not the result of a revolutionary plan, rather more of an evolution. It happened […]

Read More

Requests’ Two APIs

Kenneth Reitz’s excellent Requests library has been praised, rightfully, for its excellent API. In fact, its API is so good that it’s been praised in a literary context, as well as by almost every programmer who has come across it. There is no question that this API is one of the best you can find […]

Read More