=================
yahoo_fantasy_api
=================
Python bindings to the Yahoo! Fantasy API
Build status
------------
.. image:: https://travis-ci.com/spilchen/yahoo_fantasy_api.svg?branch=master
:target: https://travis-ci.com/spilchen/yahoo_fantasy_api
.. image:: https://readthedocs.org/projects/yahoo-fantasy-api/badge/?version=latest
:target: https://yahoo-fantasy-api.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Installation
------------
This package can be installed via pip:
::
pip install yahoo_fantasy_api
or from the repo:
::
git clone https://github.com/spilchen/yahoo_fantasy_api
cd yahoo_fantasy_api
python setup.py install
Documentation
-------------
The documentation are hosted at readthedocs.io: https://yahoo-fantasy-api.readthedocs.io/en/latest/
Sample API Usage
----------------
::
In [1]: from yahoo_oauth import OAuth2
In [2]: import yahoo_fantasy_api as yfa
In [3]: sc = OAuth2(None, None, from_file='examples/oauth2.json')
[2019-04-04 20:55:46,745 DEBUG] [yahoo_oauth.yahoo_oauth.__init__] Checking
[2019-04-04 20:55:46,746 DEBUG] [yahoo_oauth.yahoo_oauth.token_is_valid] ELAPSED TIME : 416.15308594703674
[2019-04-04 20:55:46,746 DEBUG] [yahoo_oauth.yahoo_oauth.token_is_valid] TOKEN IS STILL VALID
In [4]: gm = yfa.Game(sc, 'mlb')
In [5]: gm.league_ids(year=2019)
Out[5]: ['388.l.27081']
In [6]: lg = gm.to_league('388.l.27081')
In [7]: lg.stat_categories()
Out[7]:
[{'display_name': 'R', 'position_type': 'B'},
{'display_name': 'HR', 'position_type': 'B'},
{'display_name': 'RBI', 'position_type': 'B'},
{'display_name': 'SB', 'position_type': 'B'},
{'display_name': 'AVG', 'position_type': 'B'},
{'display_name': 'OBP', 'position_type': 'B'},
{'display_name': 'W', 'position_type': 'P'},
{'display_name': 'K', 'position_type': 'P'},
{'display_name': 'HLD', 'position_type': 'P'},
{'display_name': 'ERA', 'position_type': 'P'},
{'display_name': 'WHIP', 'position_type': 'P'},
{'display_name': 'NSV', 'position_type': 'P'}]
In [8]: lg.team_key()
Out[8]: '388.l.27081.t.5'
In [9]: lg.current_week()
Out[9]: 12
In [10]: lg.end_week()
Out[10]: 24
In [11]: lg.week_date_range(12)
Out[11]: (datetime.date(2019, 6, 17), datetime.date(2019, 6, 23))
In [12]: tm = lg.to_team('388.l.27081.t.5')
In [13]: tm.roster(1)
Out[13]:
[{'player_id': 8578,
'name': 'Buster Posey',
'position_type': 'B',
'eligible_positions': ['C', '1B', 'Util'],
'selected_position': 'C'},
{'player_id': 8967,
'name': 'Paul Goldschmidt',
'position_type': 'B',
'eligible_positions': ['1B', 'Util'],
'selected_position': '1B'},
{'player_id': 9961,
'name': 'Travis Shaw',
'position_type': 'B',
'eligible_positions': ['1B', '2B', '3B', 'Util'],
'selected_position': '2B'},
{'player_id': 9105,
'name': 'Nolan Arenado',
'position_type': 'B',
'eligible_positions': ['3B', 'Util'],
'selected_position': '3B'},
{'player_id': 9468,
'name': 'Jonathan Villar',
'position_type': 'B',
'eligible_positions': ['2B', 'SS', 'Util'],
'selected_position': 'SS'},
...
{'player_id': 7847,
'name': 'Andrew Miller',
'position_type': 'P',
'eligible_positions': ['RP'],
'selected_position': 'RP'}]
In [14]: fa_CF = lg.free_agents('CF')
In [15]: len(fa_CF)
Out[15]: 60
In [11]: fa_CF[0]
Out[11]:
{'player_id': 8370,
'name': 'Dexter Fowler',
'position_type': 'B',
'eligible_positions': ['CF', 'RF', 'Util']}
Raw data
{
"_id": null,
"home_page": "http://github.com/spilchen/yahoo_fantasy_api",
"name": "yahoo-fantasy-api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "",
"author": "Matt Spilchen",
"author_email": "matt.spilchen@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0d/d9/53a6467f81639abb0c95ad2abf5a66078d8aac286edf19f8c8f5bf33e3e6/yahoo_fantasy_api-2.8.0.tar.gz",
"platform": null,
"description": "=================\nyahoo_fantasy_api\n=================\n\nPython bindings to the Yahoo! Fantasy API\n\nBuild status\n------------\n\n.. image:: https://travis-ci.com/spilchen/yahoo_fantasy_api.svg?branch=master\n :target: https://travis-ci.com/spilchen/yahoo_fantasy_api\n \n.. image:: https://readthedocs.org/projects/yahoo-fantasy-api/badge/?version=latest\n :target: https://yahoo-fantasy-api.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\nInstallation\n------------\n\nThis package can be installed via pip:\n\n::\n\n pip install yahoo_fantasy_api\n\n\nor from the repo:\n\n::\n\n git clone https://github.com/spilchen/yahoo_fantasy_api\n cd yahoo_fantasy_api\n python setup.py install\n\nDocumentation\n-------------\n\nThe documentation are hosted at readthedocs.io: https://yahoo-fantasy-api.readthedocs.io/en/latest/\n\nSample API Usage\n----------------\n\n::\n\n In [1]: from yahoo_oauth import OAuth2\n \n In [2]: import yahoo_fantasy_api as yfa\n \n In [3]: sc = OAuth2(None, None, from_file='examples/oauth2.json')\n [2019-04-04 20:55:46,745 DEBUG] [yahoo_oauth.yahoo_oauth.__init__] Checking\n [2019-04-04 20:55:46,746 DEBUG] [yahoo_oauth.yahoo_oauth.token_is_valid] ELAPSED TIME : 416.15308594703674\n [2019-04-04 20:55:46,746 DEBUG] [yahoo_oauth.yahoo_oauth.token_is_valid] TOKEN IS STILL VALID\n \n In [4]: gm = yfa.Game(sc, 'mlb')\n \n In [5]: gm.league_ids(year=2019)\n Out[5]: ['388.l.27081']\n \n In [6]: lg = gm.to_league('388.l.27081') \n \n In [7]: lg.stat_categories()\n Out[7]:\n [{'display_name': 'R', 'position_type': 'B'},\n {'display_name': 'HR', 'position_type': 'B'},\n {'display_name': 'RBI', 'position_type': 'B'},\n {'display_name': 'SB', 'position_type': 'B'},\n {'display_name': 'AVG', 'position_type': 'B'},\n {'display_name': 'OBP', 'position_type': 'B'},\n {'display_name': 'W', 'position_type': 'P'},\n {'display_name': 'K', 'position_type': 'P'},\n {'display_name': 'HLD', 'position_type': 'P'},\n {'display_name': 'ERA', 'position_type': 'P'},\n {'display_name': 'WHIP', 'position_type': 'P'},\n {'display_name': 'NSV', 'position_type': 'P'}]\n \n In [8]: lg.team_key()\n Out[8]: '388.l.27081.t.5' \n\n In [9]: lg.current_week()\n Out[9]: 12\n\n In [10]: lg.end_week()\n Out[10]: 24\n\n In [11]: lg.week_date_range(12)\n Out[11]: (datetime.date(2019, 6, 17), datetime.date(2019, 6, 23))\n \n In [12]: tm = lg.to_team('388.l.27081.t.5')\n \n In [13]: tm.roster(1)\n Out[13]:\n [{'player_id': 8578,\n 'name': 'Buster Posey',\n 'position_type': 'B',\n 'eligible_positions': ['C', '1B', 'Util'],\n 'selected_position': 'C'},\n {'player_id': 8967,\n 'name': 'Paul Goldschmidt',\n 'position_type': 'B',\n 'eligible_positions': ['1B', 'Util'],\n 'selected_position': '1B'},\n {'player_id': 9961,\n 'name': 'Travis Shaw',\n 'position_type': 'B',\n 'eligible_positions': ['1B', '2B', '3B', 'Util'],\n 'selected_position': '2B'},\n {'player_id': 9105,\n 'name': 'Nolan Arenado',\n 'position_type': 'B',\n 'eligible_positions': ['3B', 'Util'],\n 'selected_position': '3B'},\n {'player_id': 9468,\n 'name': 'Jonathan Villar',\n 'position_type': 'B',\n 'eligible_positions': ['2B', 'SS', 'Util'],\n 'selected_position': 'SS'},\n ...\n {'player_id': 7847,\n 'name': 'Andrew Miller',\n 'position_type': 'P',\n 'eligible_positions': ['RP'],\n 'selected_position': 'RP'}]\n\n In [14]: fa_CF = lg.free_agents('CF')\n\n In [15]: len(fa_CF)\n Out[15]: 60\n\n In [11]: fa_CF[0]\n Out[11]:\n {'player_id': 8370,\n 'name': 'Dexter Fowler',\n 'position_type': 'B',\n 'eligible_positions': ['CF', 'RF', 'Util']}\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python bindings to access the Yahoo! Fantasy APIs",
"version": "2.8.0",
"project_urls": {
"Homepage": "http://github.com/spilchen/yahoo_fantasy_api"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0dd953a6467f81639abb0c95ad2abf5a66078d8aac286edf19f8c8f5bf33e3e6",
"md5": "1792da0c4293680b4f8aa32ebf8debc4",
"sha256": "549821dac06d37eba2e22cc7f1448ad78769a6dedec796af75cd80d48d7c0677"
},
"downloads": -1,
"filename": "yahoo_fantasy_api-2.8.0.tar.gz",
"has_sig": false,
"md5_digest": "1792da0c4293680b4f8aa32ebf8debc4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 24856,
"upload_time": "2023-09-17T14:43:22",
"upload_time_iso_8601": "2023-09-17T14:43:22.542715Z",
"url": "https://files.pythonhosted.org/packages/0d/d9/53a6467f81639abb0c95ad2abf5a66078d8aac286edf19f8c8f5bf33e3e6/yahoo_fantasy_api-2.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-17 14:43:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spilchen",
"github_project": "yahoo_fantasy_api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "yahoo-fantasy-api"
}