Thanks Vinay for the reply. yes output is optional, However when I am not passing it, status of decryption is 'ok' but it doesn't replace the filename.zip.gpg to filename.zip. But does it mean it is decrypted and I just have to rename the file?
gpg = gnupg.GPG(gnupghome='/tmp')
import_result = gpg.import_keys(key_data)
import_result.count
2
local_file_name = '/tmp/Test_EXTRACT_2021_JUN_1.zip.gpg'
with open(local_file_name, 'rb') as d_file:
status = gpg.decrypt_file(d_file)
print (status.status)
decryption ok
print (status.stderr)
[GNUPG:] ENC_TO D15FE17E0EA5B96F 1 0
[GNUPG:] KEY_CONSIDERED 56A1C38138ABFD4A1A17E836D72E5ED3654FDF66 0
[GNUPG:] KEY_CONSIDERED 56A1C38138ABFD4A1A17E836D72E5ED3654FDF66 0
[GNUPG:] DECRYPTION_KEY E62E660B971FD1C9B76C132AD15FE17E0EA5B96F 56A1C38138ABFD4A1A17E836D72E5ED3654FDF66 -
[GNUPG:] KEY_CONSIDERED 56A1C38138ABFD4A1A17E836D72E5ED3654FDF66 0
gpg: encrypted with 2048-bit RSA key, ID D15FE17E0EA5B96F, created 2019-11-13
"Test-Key"
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_COMPLIANCE_MODE 23
[GNUPG:] DECRYPTION_INFO 2 7
[GNUPG:] PLAINTEXT 62 1628214591 Test_EXTRACT_2021_JUN_1.zip.gpg
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] GOODMDC
[GNUPG:] END_DECRYPTION
os.listdir('/tmp/')
['hsperfdata_jenkins', 'S.gpg-agent', 'S.gpg-agent.extra', 'S.gpg-agent.browser', 'S.gpg-agent.ssh', 'Test_EXTRACT_2021_JUN_1.zip.gpg', 'pubring.kbx~', 'pubring.kbx', 'trustdb.gpg', 'private-keys-v1.d']