Finding skilled pythonistas for micro-jobs?
I'm a partner in a design and technology studio that creates large-scale interactive exhibits for museums. We are agile - by choice. For big 6-12 month projects, we try and secure exceptional python talent on contract. The python job board addresses this need. Every few weeks though I run up against a bite-sized programming problem begging to be farmed out by our small company. The tasks themselves span the gamut from data wrangling (format conversions) to SWIG wrappers to Twisted to pyOpenGL. Often the task is 1 or 2 days of work. Not really big enough to warrant a job search, a contract, or even someone's full-time attention. The type of problem that is perfectly suited to a CS student or daytime programmer looking to make some extra money. Presently, when one of these jobs pops up, I just add 8-16 hours to my work week - much to the dismay of my 3-year old daughter who'd rather I pay someone and go to the park. The nice thing though about our bite-sized jobs is that the goals are perfectly clear because we are religious in our use of unit testing and test-driven development. Any suggestions then for locating skilled Python/C++ programmers for these small (micro) jobs? Cheers, Darran. -- http://mail.python.org/mailman/listinfo/python-list
urllib2 POST problem
I'm struggling with using urllib2 to access the Harvest time-tracking web service (http://www.getharvest.com/api). GET is working fine. POST is giving me a problem. Here is an example that creates a new time-tracking entry using curl. $ curl http://subdomain.harvestapp.com/daily/add -H 'Accept: application/xml' \ -H 'Content-Type: application/xml' \ -u myusername:mypassword \ -d 'testing API3.56575079702Thu, 13 Sep 2007' Here's a selection of info from running the above with --verbose output: * About to connect() to edmstudio.harvestapp.com port 80 > POST /daily/add HTTP/1.1 > Authorization: Basic x > Accept: application/xml > Content-Type: application/xml > Content-Length: 154 > > testing > API3.56575079702Thu, > 13 Sep 2007HTTP/1.1 201 Created Notice that 1) it is a POST, and 2) the data is going across as an unencoded (xml) string. Now here is my attempt to achieve this with python's urllib2: entry = "testing API3.56575079702Thu, 13 Sep 2007" import urllib2 import base64 opener = urllib2.build_opener() opener.addheaders = [ ('Content-Type', 'application/xml'), ('Accept', 'application/xml'), ('Authorization', 'Basic %s' \ % base64.encodestring('%s:%s' % (myusername, mypassword)))] # this GET works just fine - proof that authentication is correct req = urllib2.Request(url='http://subdomain.harvestapp.com/daily') response = opener.open(req) print response.read() # this POST (same data as the above curl example) fails with an internal server error (500) req = urllib2.Request(url='http://subdomain.harvestapp.com/daily/add', data=entry) response = opener.open(req) print response.read() I'm stumped. As always, any help is much appreciated. -- http://mail.python.org/mailman/listinfo/python-list
character set gobbledy-gook ascii translation ...
I'm parsing a file with the mailbox and email modules and come across subject headers like: =?us-ascii?Q?Re=3A=20=5Bosg=2Duser=5D=20Culling=20problem?= and =?gb2312?B?cXVlc3Rpb24gYWJvdXQgbG9hZGluZyBmbHQgbGFyZ2UgdGVycmFpbiA=?= I've looked at the Charset class but can't figure out how to use it to convert the above strings to a human readable form. Generally, I imagine that there is no guarantee that an encoded string can be rendered meaningfully in ASCII - but these are posts to an English language mai list so it should be possible for this restricted case. I can guess the translation in the first example above but I'm hoping there is a Python module that'll do it for me. Any help is much appreciated. Cheers, Darran. -- http://mail.python.org/mailman/listinfo/python-list
smart logging and the "inspect" module ...
I was playing around with the inspect module the other day trying to write a quick and dirty "smart" logger. By this I mean that writing a message to the global log would also yield some info about the calling scope. If you look at my function "test" below, I'd ideally like log messages: foo.py:test, "message 1" foo.py:Foo.__init__, "message 2" foo.py:Foo.bar, "message 3" For the life of me I can't figure out how to get this info without resorting to ridiculous things like parsing the source code (available via inspect.stack. Any help would be much appreciated - my unit tests are failing on this at the moment ;-) Cheers, Darran. # foo.py - import inspect class Log: def __init__(self): pass def write(self, msg): print "" print msg print "" cframe, cmodule, cline, cfunction, csrc, tmp = inspect.stack()[1] print inspect.stack() # I want to determine if cfunction is a regular function or a class method. # If the latter, what is the name of the class? del cframe def test(): log = Log() log.write('message 1) class Foo: def __init__(self): log.write('message 2') def bar(self): log.write('message 3') f = Foo() f.bar() test() #- end of foo.py -- -- http://mail.python.org/mailman/listinfo/python-list