Created
October 2, 2017 19:40
-
-
Save asanger/cc5772094f65f3abad444bd93448cdee to your computer and use it in GitHub Desktop.
loading json file and base64 decoding a value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"username": "testuser", | |
"password": "bXlwYXNzd29yZA==" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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