I’m currently working on a script in Python which includes Encrypting/Decrypting files with GnuPG, and found this article pretty useful in general for working with GnuPG programmatically.

There is also a Gnu library for Python to work with GnuPG called GnuPGInterface.