pro-sports-transactions


Namepro-sports-transactions JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/rsforbes/pro_sports_transactions
SummaryA Python Library for Consuming Transactions from Pro Sports Transactions (https://www.prosportstransactions.com)
upload_time2023-05-22 13:50:59
maintainerRandy Forbes
docs_urlNone
authorRandy Forbes
requires_python>=3.11,<4.0
licenseMIT
keywords api basketball baseball data data science draft fines football hockey injuries mlb mls nba nfl nhl prosports prosportstransactions pro sports pro sports transactions soccer sports stats trades transactions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Pro Sports Transactions API
===============

Pro Sports Transactions is a Python API client-library for https://www.prosportstransactions.com enabling software engineers, data scientists, and sports fans with the ability to easily retrieve trades, free agent movements, signings, injuries, disciplinary actions, legal/criminal actions, and much more for five of the North American professional leagues: MLB, MLS, NBA, NFL, and NHL.

&nbsp;
# About
What is sports data without the transactions?
- "Did he just throw his mouthpiece into the stands?"
- "Yep."

`2023-01-27	| Warriors | • Stephen Curry | fined $25,000 by NBA for throwing his mouthpiece into the stands`
  
&nbsp;
# Getting Started
## Usage
```python
from datetime import date
import asyncio
import pro_sports_transactions as pst

# League (MLB, MLS, NBA, NFL, and NHL)
league = pst.League.NBA

# Disciplinary Actions, Injured List, Injuries,
# Legal Incidents, Minor League To/For, Personal Reasons,
# and Movement (e.g., Trades, Acquisitions, Waivers, Draft Picks, etc.)
transaction_types = tuple([t for t in pst.TransactionType])

# From the start of the 2022-23 NBA Regular Season
start_date = date.fromisoformat("2022-10-18")

# From the end of the 2022-23 NBA Regular Season
end_date = date.fromisoformat("2023-04-09")

# Pro Sports Transactions provides 25 rows (one page) at a time.
# The first row of the first page is always 0, and ends with 24.
# The first row of the second page is always 25, and ends with 49.
# Note: If the starting_row is set to 9; the 10th row of the results,
# then the last row of the first page wil be 34 (9 + 25)..
starting_row = 0

# Define the corouting that will be called by our code
async def search_transactions() -> str:
    
    # How to Search for Transactions
    return await pst.Search(
        # Required
        league=league, 
        # Required (at least one)
        transaction_types=transaction_types,
        # Optional
        start_date=start_date, 
        # Optional
        end_date=end_date,
        # Optional
        player="LeBron James",
        # Optional
        team="Lakers",
        # Optional
        starting_row=starting_row,
    ).get_dataframe() # Supports get_dict(), and get_json()

# Example execution block
if __name__ == "__main__":
    df = asyncio.run(search_transactions())
```
## Results
```
# DataFrame
print(df)

# returns
          Date    Team        Acquired    Relinquished                                     Notes
0   2022-11-10  Lakers                  • LeBron James  placed on IL with strained left adductor
1   2022-11-25  Lakers  • LeBron James                                         activated from IL
2   2022-12-07  Lakers                  • LeBron James         placed on IL with sore left ankle
3   2022-12-09  Lakers  • LeBron James                                         activated from IL
4   2022-12-19  Lakers                  • LeBron James         placed on IL with sore left ankle
5   2022-12-21  Lakers  • LeBron James                                         activated from IL
6   2023-01-09  Lakers                  • LeBron James         placed on IL with sore left ankle
7   2023-01-12  Lakers  • LeBron James                                         activated from IL
8   2023-02-09  Lakers                  • LeBron James         placed on IL with sore left ankle
9   2023-02-15  Lakers  • LeBron James                                         activated from IL
10  2023-02-27  Lakers                  • LeBron James       placed on IL with right foot injury
11  2023-03-26  Lakers  • LeBron James                                         activated from IL

# Pages
print(df.attrs["pages])

# returns
1

```

# Requirements
Pro Sports Transactions presents data in an HTML table. To make retrieval easy, [`pandas.read_html`](https://pandas.pydata.org/docs/reference/api/pandas.read_html.html) is used which in turn results in additional depencies. The following are a list of required libraries: 
- python = "^3.11"
- aiohttp = "^3.8.4"
- pandas = "^2.0.0"
- brotli = "^1.0.9"
- lxml = "^4.9.2"
- html5lib = "^1.1"
- bs4 = "^0.0.1"

&nbsp;
# Thank You Frank Marousek!
Huge thanks to Frank Marousek @ Pro Sports Transactions for all of his efforts, and the efforts of those who have helped him, in compiling an excellent source of transactional information.
  
&nbsp;
# Disclaimer on accuracy, usage, and completeness of information.
The Pro Sports Transactions API is in no way affiliated with [Pro Sports Transactions](https://www.prosportstransactions.com/). The Pro Sports Transactions API provides a means for programatic access to [Pro Sports Transactions](https://www.prosportstransactions.com/). While the The Pro Sports Transactions API is open source under an MIT License, usage of all information obtained via the Pro Sports Transactions API is subject to all rights reserved by [Pro Sports Transactions](https://www.prosportstransactions.com/). No warranty, express or implied, is made regarding accuracy, adequacy, completeness, legality, reliability or usefulness of any information.

For questions, concerns, or other regarding the information provided via the Pro Sports Transaction API, please visit [Pro Sports Transactions](https://www.prosportstransactions.com/).
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rsforbes/pro_sports_transactions",
    "name": "pro-sports-transactions",
    "maintainer": "Randy Forbes",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "randy.forbes@gmail.com",
    "keywords": "api,basketball,baseball,data,data science,draft,fines,football,hockey,injuries,mlb,mls,nba,nfl,nhl,prosports,prosportstransactions,pro sports,pro sports transactions,soccer,sports,stats,trades,transactions",
    "author": "Randy Forbes",
    "author_email": "randy.forbes@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4e/76/92bae012aabaaed03bb5a0262867690a870b7b59154d55b152f6a499398d/pro_sports_transactions-1.0.0.tar.gz",
    "platform": null,
    "description": "Pro Sports Transactions API\n===============\n\nPro Sports Transactions is a Python API client-library for https://www.prosportstransactions.com enabling software engineers, data scientists, and sports fans with the ability to easily retrieve trades, free agent movements, signings, injuries, disciplinary actions, legal/criminal actions, and much more for five of the North American professional leagues: MLB, MLS, NBA, NFL, and NHL.\n\n&nbsp;\n# About\nWhat is sports data without the transactions?\n- \"Did he just throw his mouthpiece into the stands?\"\n- \"Yep.\"\n\n`2023-01-27\t| Warriors | \u2022 Stephen Curry | fined $25,000 by NBA for throwing his mouthpiece into the stands`\n  \n&nbsp;\n# Getting Started\n## Usage\n```python\nfrom datetime import date\nimport asyncio\nimport pro_sports_transactions as pst\n\n# League (MLB, MLS, NBA, NFL, and NHL)\nleague = pst.League.NBA\n\n# Disciplinary Actions, Injured List, Injuries,\n# Legal Incidents, Minor League To/For, Personal Reasons,\n# and Movement (e.g., Trades, Acquisitions, Waivers, Draft Picks, etc.)\ntransaction_types = tuple([t for t in pst.TransactionType])\n\n# From the start of the 2022-23 NBA Regular Season\nstart_date = date.fromisoformat(\"2022-10-18\")\n\n# From the end of the 2022-23 NBA Regular Season\nend_date = date.fromisoformat(\"2023-04-09\")\n\n# Pro Sports Transactions provides 25 rows (one page) at a time.\n# The first row of the first page is always 0, and ends with 24.\n# The first row of the second page is always 25, and ends with 49.\n# Note: If the starting_row is set to 9; the 10th row of the results,\n# then the last row of the first page wil be 34 (9 + 25)..\nstarting_row = 0\n\n# Define the corouting that will be called by our code\nasync def search_transactions() -> str:\n    \n    # How to Search for Transactions\n    return await pst.Search(\n        # Required\n        league=league, \n        # Required (at least one)\n        transaction_types=transaction_types,\n        # Optional\n        start_date=start_date, \n        # Optional\n        end_date=end_date,\n        # Optional\n        player=\"LeBron James\",\n        # Optional\n        team=\"Lakers\",\n        # Optional\n        starting_row=starting_row,\n    ).get_dataframe() # Supports get_dict(), and get_json()\n\n# Example execution block\nif __name__ == \"__main__\":\n    df = asyncio.run(search_transactions())\n```\n## Results\n```\n# DataFrame\nprint(df)\n\n# returns\n          Date    Team        Acquired    Relinquished                                     Notes\n0   2022-11-10  Lakers                  \u2022 LeBron James  placed on IL with strained left adductor\n1   2022-11-25  Lakers  \u2022 LeBron James                                         activated from IL\n2   2022-12-07  Lakers                  \u2022 LeBron James         placed on IL with sore left ankle\n3   2022-12-09  Lakers  \u2022 LeBron James                                         activated from IL\n4   2022-12-19  Lakers                  \u2022 LeBron James         placed on IL with sore left ankle\n5   2022-12-21  Lakers  \u2022 LeBron James                                         activated from IL\n6   2023-01-09  Lakers                  \u2022 LeBron James         placed on IL with sore left ankle\n7   2023-01-12  Lakers  \u2022 LeBron James                                         activated from IL\n8   2023-02-09  Lakers                  \u2022 LeBron James         placed on IL with sore left ankle\n9   2023-02-15  Lakers  \u2022 LeBron James                                         activated from IL\n10  2023-02-27  Lakers                  \u2022 LeBron James       placed on IL with right foot injury\n11  2023-03-26  Lakers  \u2022 LeBron James                                         activated from IL\n\n# Pages\nprint(df.attrs[\"pages])\n\n# returns\n1\n\n```\n\n# Requirements\nPro Sports Transactions presents data in an HTML table. To make retrieval easy, [`pandas.read_html`](https://pandas.pydata.org/docs/reference/api/pandas.read_html.html) is used which in turn results in additional depencies. The following are a list of required libraries: \n- python = \"^3.11\"\n- aiohttp = \"^3.8.4\"\n- pandas = \"^2.0.0\"\n- brotli = \"^1.0.9\"\n- lxml = \"^4.9.2\"\n- html5lib = \"^1.1\"\n- bs4 = \"^0.0.1\"\n\n&nbsp;\n# Thank You Frank Marousek!\nHuge thanks to Frank Marousek @ Pro Sports Transactions for all of his efforts, and the efforts of those who have helped him, in compiling an excellent source of transactional information.\n  \n&nbsp;\n# Disclaimer on accuracy, usage, and completeness of information.\nThe Pro Sports Transactions API is in no way affiliated with [Pro Sports Transactions](https://www.prosportstransactions.com/). The Pro Sports Transactions API provides a means for programatic access to [Pro Sports Transactions](https://www.prosportstransactions.com/). While the The Pro Sports Transactions API is open source under an MIT License, usage of all information obtained via the Pro Sports Transactions API is subject to all rights reserved by [Pro Sports Transactions](https://www.prosportstransactions.com/). No warranty, express or implied, is made regarding accuracy, adequacy, completeness, legality, reliability or usefulness of any information.\n\nFor questions, concerns, or other regarding the information provided via the Pro Sports Transaction API, please visit [Pro Sports Transactions](https://www.prosportstransactions.com/).",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python Library for Consuming Transactions from Pro Sports Transactions (https://www.prosportstransactions.com)",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://github.com/rsforbes/pro_sports_transactions/blob/main/README.md",
        "Homepage": "https://github.com/rsforbes/pro_sports_transactions",
        "Repository": "https://github.com/rsforbes/pro_sports_transactions"
    },
    "split_keywords": [
        "api",
        "basketball",
        "baseball",
        "data",
        "data science",
        "draft",
        "fines",
        "football",
        "hockey",
        "injuries",
        "mlb",
        "mls",
        "nba",
        "nfl",
        "nhl",
        "prosports",
        "prosportstransactions",
        "pro sports",
        "pro sports transactions",
        "soccer",
        "sports",
        "stats",
        "trades",
        "transactions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3013846b04e65656de820858afb2864964473129d7d78ed96d91c847b179b437",
                "md5": "12be3113037eee53f5bd042e9fbd56b4",
                "sha256": "7b71fd81bfa395f0592e3f131a6923e90b2d13c14ba33d7e806e1ce8aabbe93a"
            },
            "downloads": -1,
            "filename": "pro_sports_transactions-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12be3113037eee53f5bd042e9fbd56b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 6328,
            "upload_time": "2023-05-22T13:50:58",
            "upload_time_iso_8601": "2023-05-22T13:50:58.586241Z",
            "url": "https://files.pythonhosted.org/packages/30/13/846b04e65656de820858afb2864964473129d7d78ed96d91c847b179b437/pro_sports_transactions-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e7692bae012aabaaed03bb5a0262867690a870b7b59154d55b152f6a499398d",
                "md5": "f4c9b66415b6231a694f784d5a716305",
                "sha256": "17afa7e9de8cb5cdd709651fdd13cdd1f110e37ba14883efa793b38725fae4d2"
            },
            "downloads": -1,
            "filename": "pro_sports_transactions-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f4c9b66415b6231a694f784d5a716305",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 5742,
            "upload_time": "2023-05-22T13:50:59",
            "upload_time_iso_8601": "2023-05-22T13:50:59.915671Z",
            "url": "https://files.pythonhosted.org/packages/4e/76/92bae012aabaaed03bb5a0262867690a870b7b59154d55b152f6a499398d/pro_sports_transactions-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-22 13:50:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rsforbes",
    "github_project": "pro_sports_transactions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pro-sports-transactions"
}
        
Elapsed time: 0.08663s