Skip to content

Instantly share code, notes, and snippets.

@manucabral
Last active September 21, 2021 22:25
Show Gist options
  • Save manucabral/99942dec762631272ab5c1a8e770b491 to your computer and use it in GitHub Desktop.
Save manucabral/99942dec762631272ab5c1a8e770b491 to your computer and use it in GitHub Desktop.
Github user data to json
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