python datasci-intro-part_2.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python datasci-intro-part_2.py相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env python
"""Script to get Github info using API"""
import requests


# main URL that doesn't get changed
baseurl = "https://api.github.com/users/"
# add any number of usernames here
users = ['kennethreitz', 'mitsuhiko', 'jkbrzt', 'nvbn', 'donnemartin']
# Which JSON properties we want to catch
properties = ['name', 'id', 'html_url', 'public_repos', 'created_at']


# run loop through all the users
for username in users:
    # make API url with Github username
    current_user = baseurl + username
    # take response from the url
    response = requests.get(current_user)
    # conversion to human readable format
    user_info = response.json()
    # print all the properties
    for property in properties:
        print("{}: {}".format(property, user_info[property]))
    print('')


以上是关于python datasci-intro-part_2.py的主要内容,如果未能解决你的问题,请参考以下文章

代写python,代写python编程,python代写,python编程代写,留学生python代写

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍