urllib2 - python gnupg decrypt error -


i'm new python , want decrypt downloadable pgp encrypted file in python using gnupg module (http://pythonhosted.org/python-gnupg/) (i thought simple api calls should easy have wasted time on thought of getting help).

so i'm able download file url in python, , tried decryping gpg4win software, , works well. different errors when try decrypt in python using gnupg module.

ideally download file url, , decrypt it, , store in file (rather downloading file, saving it, decryting file, saving new decypted file)

this prototype code:

#test  import urllib2 import gnupg  z='https://abcd_url' u = urllib2.urlopen(z) localfile = open('file_haha_test2', 'w+b') localfile.write(u.read())  gpg = gnupg.gpg() #gpg.encoding = 'utf-8'  ##gpg = gnupg.gpg(gnupghome='c:\\program files (x86)\\gnu\\desktop\\gnupg', ##                                gpgbinary='c:\\program files          (x86)\\gnu\\desktop\\gnupg\\gpg.exe', ##                                keyring='c:\\user\\desktop\\encryption keys\\secret-key-73f.asc')   status = str(gpg.decrypt(u.read(), passphrase='hp',  output='hahahah.txt'))       #status = str(gpg.decrypt_file(localfile, passphrase='hp',output='hahahah.txt'))  #status = gpg.decrypt_file(localfile)  print status  #localfile.close() 

i got different errors different syntax(you can see them commented above). i'm getting not getting output on screen. think should print contents.

i want working possible , appreciated.

i assume using library on pypi ‘gnupg’.

have tried library on pypi ‘python-gnupg’?

the 2 libraries have quite similar apis, , both have activity in recent years. don't know better in general.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -