https://github.com/karthikgangadhar/pycricapi
This is a wrapper for cricapi written using python
https://github.com/karthikgangadhar/pycricapi
Last synced: about 2 months ago
JSON representation
This is a wrapper for cricapi written using python
- Host: GitHub
- URL: https://github.com/karthikgangadhar/pycricapi
- Owner: KarthikGangadhar
- License: apache-2.0
- Created: 2018-10-23T04:55:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-09T06:53:06.000Z (over 5 years ago)
- Last Synced: 2025-02-26T18:05:03.776Z (2 months ago)
- Language: Python
- Homepage: https://pypi.org/project/cricapi/
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cricapi
[](https://pypi.org/project/cricapi/)
[](https://pypi.org/project/cricapi/)
[](https://pypi.org/project/cricapi/)
[](https://codecov.io/github/karthikgangadhar/pycricapi)
[](https://github.com/karthikgangadhar/pycricapi/graphs/contributors)The [cricapi](http://www.cricapi.com/), Free to use, super-high bandwidth, high performance Cricket API. Targeted at Developers and Cricket lovers.
The endpoints exposed are as follows:* `cricapi.cricket( )` provides live scrores of ongoing match
* `cricapi.matches( )` provides upcoming match fixtures
* `cricapi.matchCalender( )` provides international fixtures
* `cricapi.cricketScore( )` provides detailed score card of the match
* `cricapi.playerStats( )` provides players carrer info and stats
* `cricapi.fantasySummary( )` provides match info and stats
* `cricapi.fantasySquad( )` provides team players info
* `cricapi.playerFinder( )` provides players ids matching given name string
In order to use the above endpoints, u need to have an api_key which can use generated by signing into [cricpapi](http://www.cricapi.com). For testing purpose can use test_api_key `"TESTKEY0273"`Usage of Cricapi:
``` {.sourceCode .python}
>>> import cricapi
>>> apikey = "TESTKEY0273"
>>> criapi = cricapi.Cricapi(apikey)
```
#### matches```
>>> criapi.matches()
{u'matches': [{u'toss_winner_team': u'Australia Women', u'team-2': u'Pakistan Women' ...}
```
#### cricket```
>>> criapi.cricket()
{u'v': u'1', u'cache': True, u'provider': {u'url': u'https://cricapi.com/', u'source': ...}
```
#### matchCalender```
>>> criapi.matchCalender()
{u'v': u'1', u'cache': True, u'provider': {u'url': u'https://criapi.com/', u'source': ...}
```The endpoints cricketScore() and playerStats() require a string input field "unique_id" and "pid"(player_id). "unique_id" for each match is available from the cricket() endpoint response. and for "pid"(player_id) need to visit [cricapi players page](http://www.cricapi.com/players/). usage is as follows:
#### cricketScore
```
>>> params = {'unique_id':1034809}
>>> criapi.cricketScore(params)
{u'v': u'1', u'ttl': 3, u'team-2': u'India', u'matchStarted': True, u'team-1': u'England', u'provider': {u'url':u'https://cricapi.com/', u'source': u'Various', u'pubDate': u'2018-10-23T06:58:07.090Z'}, u'creditsLeft': 206}
```
#### playerStats```
>>> params = {'pid':35320}
>>> criapi.playerStats(params)
{u'profile': u"\n\nSachin Tendulkar has been the most complete batsman of his time, the most prolific runmaker of all time, and arguably the biggest cricket icon the game has ...}
```#### Fantasy API are billable since they're designed to help you generate income by running Fantasy Cricket portals. ####
Each hit is 1 credit. You get 250 credits free. Deducted from your prepaid account.#### fantasySquad
```
>>> params = {'unique_id':1034809}
>>> criapi.fantasySquad(params)
{u'v': u'1', u'cache': True, u'provider': {u'url': u'https://cricapi.com/', u'source': u'Various', u'pubDate': u'2018-10-23T07:16:02.191Z'}, u'squad': [{u'players': [{u'pid': ... }
```
#### fantasySummary```
>>> params = {'unique_id':1034809}
>>> criapi.fantasySummary(params)
{u'type': u'Test', u'ttl': 7, u'provider': {u'url': u'https://cricapi.com/', u'source': u'Various', u'pubDate': u'2018-10-23T07:20:22.701Z'}, u'dateTimeGMT': u'2016-11-09T04:00:00.000Z', u'v': u'1', u'data': {u'toss_winner_tea ...}
```#### playerFinder
```
>>> params = {'name':'sachin'}
>>> criapi.playerFinder(params)
{u'ttl': 164, u'provider': {u'url': u'https://cricapi.com/', u'source': u'Various', u'pubDate': u'2018-10-23T07:24:47.164Z'}, u'v': u'1', u'data': [{u'fullName': u'Sachin Rana', u'pid': 33757, u'name': u'Sachin Rana'}, {u'full ...}
```Cricapi officially supports Python 2.7 & 3.4–3.7, and runs great on
PyPy.Installation
------------To install Cricapi, simply use [pipenv](http://pipenv.org/) (or pip, of
course):``` {.sourceCode .bash}
$ pipenv install cricapi
```How to Contribute
-----------------1. Check for open issues or open a fresh issue to start a discussion
around a feature idea or a bug. There is a [Contributor
Friendly](https://github.com/karthikgangadhar/pycricapi/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open)
tag for issues that should be ideal for people who are not very
familiar with the codebase yet.
2. Fork [the repository](https://github.com/karthikgangadhar/pycricapi) on
GitHub to start making your changes to the **master** branch (or
branch off of it).
3. Write a test which shows that the bug was fixed or that the feature
works as expected.
4. Send a pull request and bug the maintainer until it gets merged and
published. :) Make sure to add yourself to
[AUTHORS](https://github.com/karthikgangadhar/pycricapi/blob/master/AUTHORS.rst).