UPDATE: I eventually switched to Requests

I 've had great success stress testing the GUI of web applications using Python 2.7 and the poster module

I initially wrote some GET / POSTS using urllib2 but found it hard to support things like cookies and multipart/form-data encodings (to simulate upload of files). The poster module supported all these requirements easily. See a related SO question of mine.

To install poster on my Ubuntu 16.04 machine, I downloaded its Python 2.7 egg from here and then did:

sudo easy_install poster-0.8.1-py2.7.egg

If you can't install it, I've found that the following also works:

#!/usr/bin/env python
import sys
sys.path.append('/absolute/path/to/the/egg/poster-0.8.1-py2.7.egg')
from poster.encode        import multipart_encode
from poster.streaminghttp import register_openers