Python学习笔记(十七)

对应17章内容

import requests

url='https://api.github.com/search/repositories?q=language:python&sort=stars'
headers={'Accept':'application/vnd.github.v3+json'}
r=requests.get(url,headers=headers)
print(f"Status code:{r.status_code}")

response_dict=r.json()
print(f"Total repositories:{response_dict['total_count']}")
      
repo_dicts=response_dict['items']
print(f"repositories return:{len(repo_dicts)}")
      
repo_dict=repo_dicts[0]

print("\nselected information about first repository:")
print(f"name: {repo_dict['name']}")
print(f"owner:{repo_dict['owner']['login']}")
print(f"stars:{repo_dict['stargazers_count']}")
print(f"repository:{repo_dict['html_url']}")
print(f"created:{repo_dict['created_at']}")
print(f"updated:{repo_dict['updated_at']}")
print(f"descript:{repo_dict['description']}")

获取github上最受欢迎的项目

`Status code:200
Total repositories:6716556
repositories return:30

selected information about first repository:
name: public-apis
owner:public-apis
stars:110800
repository:https://github.com/public-apis/public-apis
created:2016-03-20T23:49:42Z
updated:2021-02-18T09:25:05Z
descript:A collective list of free APIs for use in software and web development.`

可以看到,GitHub上托管的项目已经在几年之内翻倍

最受欢迎的项目也从awsome-python变成了public-apis

import requests

url='https://api.github.com/search/repositories?q=language:python&sort=stars'
headers={'Accept':'application/vnd.github.v3+json'}
r=requests.get(url,headers=headers)
print(f"Status code:{r.status_code}")

response_dict=r.json()
print(f"Total repositories:{response_dict['total_count']}")
      
repo_dicts=response_dict['items']
print(f"repositories return:{len(repo_dicts)}")
    

print("\nselected information about each repository:")     
for repo_dict in repo_dicts:
    print(f"name: {repo_dict['name']}")
    print(f"owner:{repo_dict['owner']['login']}")
    print(f"stars:{repo_dict['stargazers_count']}")
    print(f"repository:{repo_dict['html_url']}")
    print(f"descript:{repo_dict['description']}")

爬取最受欢迎的仓库

`Status code:200
Total repositories:6499299
repositories return:30

selected information about each repository:
name: system-design-primer
owner:donnemartin
stars:121471
repository:https://github.com/donnemartin/system-design-primer
descript:Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
name: public-apis
owner:public-apis
stars:110800
repository:https://github.com/public-apis/public-apis
descript:A collective list of free APIs for use in software and web development.
name: Python
owner:TheAlgorithms
stars:100010
repository:https://github.com/TheAlgorithms/Python
descript:All Algorithms implemented in Python
name: Python-100-Days
owner:jackfrued
stars:99580
repository:https://github.com/jackfrued/Python-100-Days
descript:Python - 100天从新手到大师
name: youtube-dl
owner:ytdl-org
stars:90235
repository:https://github.com/ytdl-org/youtube-dl
descript:Command-line program to download videos from YouTube.com and other video sites
name: models
owner:tensorflow
stars:68671
repository:https://github.com/tensorflow/models
descript:Models and examples built with TensorFlow
name: thefuck
owner:nvbn
stars:58956
repository:https://github.com/nvbn/thefuck
descript:Magnificent app which corrects your previous console command.
name: django
owner:django
stars:55670
repository:https://github.com/django/django
descript:The Web framework for perfectionists with deadlines.
name: flask
owner:pallets
stars:53916
repository:https://github.com/pallets/flask
descript:The Python micro framework for building web applications.
name: keras
owner:keras-team
stars:50712
repository:https://github.com/keras-team/keras
descript:Deep Learning for humans
name: httpie
owner:httpie
stars:49882
repository:https://github.com/httpie/httpie
descript:As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
name: awesome-machine-learning
owner:josephmisiti
stars:48474
repository:https://github.com/josephmisiti/awesome-machine-learning
descript:A curated list of awesome Machine Learning frameworks, libraries and software.
name: ansible
owner:ansible
stars:46899
repository:https://github.com/ansible/ansible
descript:Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
name: requests
owner:psf
stars:44607
repository:https://github.com/psf/requests
descript:A simple, yet elegant HTTP library.
name: scikit-learn
owner:scikit-learn
stars:44599
repository:https://github.com/scikit-learn/scikit-learn
descript:scikit-learn: machine learning in Python
name: transformers
owner:huggingface
stars:40911
repository:https://github.com/huggingface/transformers
descript:🤗Transformers: State-of-the-art Natural Language Processing for Pytorch and TensorFlow 2.0.
name: core
owner:home-assistant
stars:40335
repository:https://github.com/home-assistant/core
descript:🏡 Open source home automation that puts local control and privacy first
name: scrapy
owner:scrapy
stars:39791
repository:https://github.com/scrapy/scrapy
descript:Scrapy, a fast high-level web crawling & scraping framework for Python.
name: big-list-of-naughty-strings
owner:minimaxir
stars:39405
repository:https://github.com/minimaxir/big-list-of-naughty-strings
descript:The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data.
name: you-get
owner:soimort
stars:39071
repository:https://github.com/soimort/you-get
descript:⏬ Dumb downloader that scrapes the web
name: face_recognition
owner:ageitgey
stars:38584
repository:https://github.com/ageitgey/face_recognition
descript:The world’s simplest facial recognition api for Python and the command line
name: HelloGitHub
owner:521xueweihan
stars:37281
repository:https://github.com/521xueweihan/HelloGitHub
descript::octocat: Find pearls on open-source seashore 分享 GitHub 上有趣、入门级的开源项目
name: cpython
owner:python
stars:36250
repository:https://github.com/python/cpython
descript:The Python programming language
name: superset
owner:apache
stars:35364
repository:https://github.com/apache/superset
descript:Apache Superset is a Data Visualization and Data Exploration Platform
name: faceswap
owner:deepfakes
stars:34188
repository:https://github.com/deepfakes/faceswap
descript:Deepfakes Software For All
name: shadowsocks
owner:shadowsocks
stars:32946
repository:https://github.com/shadowsocks/shadowsocks
descript:None
name: manim
owner:3b1b
stars:30800
repository:https://github.com/3b1b/manim
descript:Animation engine for explanatory math videos
name: XX-Net
owner:XX-net
stars:30559
repository:https://github.com/XX-net/XX-Net
descript:A proxy tool to bypass GFW.
name: CppCoreGuidelines
owner:isocpp
stars:29938
repository:https://github.com/isocpp/CppCoreGuidelines
descript:The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++
name: 12306
owner:testerSunshine
stars:29456
repository:https://github.com/testerSunshine/12306
descript:12306智能刷票,订票`

看到汉字你就知道中国程序员对GitHub的贡献不小,尤其是最后一个12306买票外挂太真实了

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值