How to add a UV Map to a Mesh Using Python
There are 2 existing resources that show this:

The best is the template for this purpose that comes with blender 2.67:

See Text Editor -> Templates -> Python -> Operator UV.

There is also a snippet in BMesh docs.