Last active
September 21, 2021 22:25
-
-
Save manucabral/99942dec762631272ab5c1a8e770b491 to your computer and use it in GitHub Desktop.
Github user data to 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
from sys import argv | |
import json | |
import requests as req | |
def main(user): | |
res = req.get(f'https://api.github.com/users/{user}') | |
data = res.json() | |
with open(f'{user}.json', 'w', encoding='utf-8') as file: | |
json.dump(data, file, ensure_ascii = False, indent = 4) | |
if __name__ == '__main__': | |
if len(argv) < 2: | |
print('Faltan argumentos') | |
main(argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment