Skip to content

Instantly share code, notes, and snippets.

@asanger
Created October 2, 2017 19:40
Show Gist options
  • Save asanger/cc5772094f65f3abad444bd93448cdee to your computer and use it in GitHub Desktop.
Save asanger/cc5772094f65f3abad444bd93448cdee to your computer and use it in GitHub Desktop.
loading json file and base64 decoding a value
{
"username": "testuser",
"password": "bXlwYXNzd29yZA=="
}
import base64
import json
with open('credentials.json') as json_data:
d = json.load(json_data)
encoded_pass = d["password"]
decoded_password = base64.b64decode(encoded_pass)
# decoded pass now lives in `decoded_password`
print decoded_password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment