python-espncricinfo:ESPNCricInfo JSON API的Python包装器

  • Y2_823194
    了解作者
  • 13.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-02 04:03
    上传日期
python-espncricinfo 一个ESPNCricinfo的比赛,摘要和球员信息的Python 3客户端。 描述 出色的espncricinfo.com网站不仅提供板球比赛的,而且还提供每个比赛的。 这个Python库提供对许多这些JSON属性以及一些辅助函数的访问。 您只需要匹配ID,即匹配页网址末尾的数字即可。 有关说明,请参见“用法”部分,有关单个功能,请参见match.py 。 免责声明:该库不用于商业用途,它或它的创建者都不与ESPNCricInfo有任何隶属关系。 该库的仅适用于代码,不适用于数据。 该库的当前版本是0.5.0。 这项工作仍在进行中,欢迎您提交错误报告和功能要求。 安装 pip3 install python - espncricinfo 用法 有关实时比赛的摘要,请创建Summary类的实例: >> > from espncricinfo .
python-espncricinfo-master.zip
  • python-espncricinfo-master
  • .github
  • ISSUE_TEMPLATE
  • bug_report.md
    473B
  • feature_request.md
    595B
  • espncricinfo
  • __init__.py
    1B
  • summary.py
    986B
  • match.py
    14.5KB
  • series.py
    3KB
  • player.py
    16.5KB
  • exceptions.py
    517B
  • setup.py
    582B
  • .gitignore
    51B
  • requirements.txt
    201B
  • changelog.md
    330B
  • setup.cfg
    253B
  • LICENSE.txt
    1KB
  • README.md
    2.8KB
  • tests.py
    602B
内容介绍
# python-espncricinfo A Python 3 client for ESPNCricinfo's match, summary and player information. ### Description The splendid espncricinfo.com site not only provides [individual HTML pages](http://www.espncricinfo.com/caribbean-premier-league-2015/engine/match/857713.html) of cricket matches, it also provides a [JSON representation of data](http://www.espncricinfo.com/caribbean-premier-league-2015/engine/match/857713.json) from each match. This Python library provides access to many of those JSON attributes as well as some helper functions. All you need is the match ID, which is the number at the end of a match page URL. See the Usage section for instructions, and see `match.py` for individual functions. Disclaimer: This library is not intended for commercial use and neither it nor its creator has any affiliation with ESPNCricInfo. The [LICENSE](LICENSE.txt) for this library applies only to the code, not to the data. The current version of this library is 0.5.0. It is very much a work in progress, and bug reports and feature requests are welcomed. ### Installation ```python pip3 install python-espncricinfo ``` ### Usage For a summary of live matches, create an instance of the `Summary` class: ```python >>> from espncricinfo.summary import Summary >>> s = Summary() >>> s.match_ids ['68079', '68209', '68081', '61375', '65429'] ``` For individual matches, pass in the ID as a string: ```python >>> from espncricinfo.match import Match >>> m = Match('64148') >>> m.description 'England [Marylebone Cricket Club] tour of Australia, Only ODI: Australia v England at Melbourne, Jan 5, 1971' ``` More recent matches will have more methods available to them (for older matches, those methods will return `None`). A full list of methods available to an instance of the `Match` class is in [the code](https://github.com/dwillis/python-espncricinfo/blob/master/espncricinfo/match.py). For player details, pass in the player ID (found in a player's URL - for example, [Ajinkya Rahane](http://www.espncricinfo.com/west-indies-v-india-2016/content/player/277916.html) is '277916'): ```python >>> from espncricinfo.player import Player >>> p = Player('277916') >>> p.name 'Ajinkya Rahane' ``` A full list of methods available to an instance of the `Player` class is in [the code](https://github.com/dwillis/python-espncricinfo/blob/master/espncricinfo/player.py). For series (or league) details, pass in the series ID (found in a match URL, for example, [India's 2018 tour of England](http://www.espncricinfo.com/series/18018/game/1119549/england-vs-india-1st-test-ind-in-eng-2018) is '18018'): ```python >>> from espncricinfo.series import Series >>> s = Series('18018') >>> s.name 'India tour of Ireland and England 2018' ``` ### Tests To run the tests: ```shell python tests.py ``` ### Requirements See requirements.txt
评论
    相关推荐