Last active
January 23, 2022 11:40
-
-
Save alexs77/339a238a510adcfb23fbf0dc0672703b to your computer and use it in GitHub Desktop.
Test JSON
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
{ "encrypted": false, "folders": [ { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" }, { "id": "XXXXXXX", "name": "XXXXXXX" } ], "items": [ { "id": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXX", "organizationId": null, "folderId": null, "type": 1, "name": "XXXXXXX", "notes": null, "favorite": false, "login": { "uris": [ { "match": null, "uri": "XXXXXXX" } ], "username": "XXX@XXXX.XXX", "password": "XXXXXXX", "totp": null }, "collectionIds": null }, { "id": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXX", "organizationId": null, "folderId": null, "type": 1, "name": "XXXXXXX", "notes": null, "favorite": false, "login": { "uris": [ { "match": null, "uri": "XXXXXXX" } ], "username": "XXX@XXXX.XXX", "password": "XXXXXXX", "totp": null }, "collectionIds": null } ] } |
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
#!/usr/bin/python3 | |
import json, sys | |
def main(): | |
data = json.load(sys.stdin) | |
for ci in data['items']: | |
try: | |
for uri in ci['login']['uris']: | |
try: | |
uri = uri['uri'] | |
print(f"uri → {uri}") | |
except: | |
print("uri not found") | |
except: | |
print("uris not found") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment