从命令行中搜索github
githsearch的Python项目详细描述
GithSearch
从命令行快速搜索github
安装
pipinstallgithsearch
用作命令行工具
options:-hor--help:displayinstructions-ror--repo[args]:searchforargsingithubrepos-uor--user[args]:searchforargsingithubusers-lor--limit:knowyourratelimitexample:githsearch-rpythontetrissampleoutput:-->https://github.com/davidcollins4481/tetris-clone--TetrisCloneinPython(PyGame)-->https://github.com/zxmarcos/pytrix--TetriscloneinPython+PyGame-->https://github.com/nickcrafford/python-pygame-tetris--QuickanddirtyTetrisclonewrittentolearnPygame.-->https://github.com/davepgreene/tetris-clone--ATetrisclonewritteninPythonwithpygame
(另外:线条以紫色交替出现,非常可爱)
以编程方式使用githsearch
您可以搜索回购协议或用户。 首先实例化主类,然后搜索repo调用get_repo,并将要搜索的术语作为参数传递:
>>>fromgithsearchimportGithSearch>>>g=GithSearch()>>>g.get_repo('python tetris clone pygame')[('https://github.com/davidcollins4481/tetris-clone','Tetris Clone in Python (PyGame)'),('https://github.com/zxmarcos/pytrix','Tetris clone in Python + PyGame'),('https://github.com/nickcrafford/python-pygame-tetris','Quick and dirty Tetris clone written to learn Pygame.'),('https://github.com/davepgreene/tetris-clone','A Tetris clone written in Python with pygame'),('https://github.com/AndreiMarks/BlindBlocks','Tetris Clone written in Python 3.2 using Pygame 1.9.2'),('https://github.com/dannyburrows/PoorMansTetris','A Tetris clone, using python and pygame'),...]
搜索输出最相关的结果。 搜索用户是相同的,但请改为调用get_user。
>>>g.get_user('test')[('test','https://github.com/test'),('prinnotamago','https://github.com/prinnotamago'),('diannt','https://github.com/diannt'),('73153','https://github.com/73153'),('ssweetin','https://github.com/ssweetin'),('deekoder','https://github.com/deekoder'),('songkang666','https://github.com/songkang666'),('ArdentZeal','https://github.com/ArdentZeal'),('gitmobiletest','https://github.com/gitmobiletest'),...]
但是请注意,githsearch使用github搜索api的免费配额,因此有一个速率限制。您可以拨打电话咨询:
>>>g.get_limit{'remaining':10,'reset':1453497872,'limit':10}
只要你不破坏api,你就应该没事的。
更改:
2016年2月:添加了命令行工具refactoring,将readme从markdown改为restructuredtext,以便在pypi上看起来更好。