pitchbase


Namepitchbase JSON
Version 0.13.1 PyPI version JSON
download
home_pagehttps://github.dena.jp/AI/pitchbase
SummaryCommand Line utility for pitchbase.
upload_time2024-08-26 23:14:24
maintainerNone
docs_urlNone
authorHiroshi Toyama
requires_pythonNone
licenseMIT
keywords pitchbase tool aws
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pitchbase

[![PyPI version](https://badge.fury.io/py/pitchbase.svg)](https://badge.fury.io/py/pitchbase)
[![Build Status](https://secure.travis-ci.org/toyama0919/pitchbase.png?branch=master)](http://travis-ci.org/toyama0919/pitchbase)

Command Line utility for pitchbase.

Support python3 only.

## Settings

### config file($HOME/.pitchbase)

```yaml
default:
  host: stg-ap.pitchbase.jp
  organization_code: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  username: hiroshi.toyama
  password: xxxxxxxxxx
  grant_type: xxxxxxxxxx
```

### environment variables

```sh
export PITCHBASE_HOST=stg-ap.pitchbase.jp
export PITCHBASE_ORGANIZATION_CODE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export PITCHBASE_USERNAME=hiroshi.toyama
export PITCHBASE_PASSWORD=xxxxxxxxxx
export PITCHBASE_GRANT_TYPE=xxxxxxxxxx
```

## Examples

#### get pitch-data by command line

```bash
$ pitchbase pitch-data --filter="game_id eq '2021051427'" | jq .
{
  "results": [
    {
      "1b_code": "2019007",
      "2b_code": "2020065",
      "3b_code": "2021049",
      "__c": 1620982019374,
      "__u": 1621089404671,
      "_id": "17bb26ebcb7c07aa1caedef7f4e1342a_2021051427_011010101",
      ...

```

#### get movie-angle by command line

```bash
$ pitchbase movie-angle --filter="game_id eq '2021080527'" | jq .
{
  "results": [
    {
      "__c": 1628685058185,
      "__u": 1628688147039,
      "_id": "6113c3021bf476531525d8b5",
      ...
```

#### get game-schedule by command line

```bash
pitchbase game-schedule --filter="game_id eq '2021080527'" | jq .
{
  "results": [
    {
      "__c": 1628160045124,
      "__u": 1628259411117,
      ...
```

#### get trackman record by command line

```bash
pitchbase trackman-record --filter="game_id eq '2021051427'" | jq .
{
  "results": [
    {
      "__c": 1628160045124,
      "__u": 1628259411117,
      ...
```

#### get player-master by command line

```bash
pitchbase player-master --filter="team.code eq 2012001" | jq .
{
  "results": [
    {
      "__c": 1610950983947,
      "__u": 1615180733457,
      "affiliation_history": null,
      "batting": "R",
      "birthday": 20010703,
      "birthplace": null,
      "blood_type": "AB",
      "disabled": false,
      "draft_year": "2019",
      "ebis_code": null,
      "face_file": "https://stg-www.pitchbase.jp/img/profile/2021/2012001/2020002.jpg",
      "fixed": true,
      "height": null,
      "is_latest": true,
      "join_date": null,
      "join_scene": null,
      "join_year": null,
      "last_game_date": null,
      "leave_date": null,
      "note": null,
      "order": null,
      "organization_code": null,
      "pitching": "R",
      "player_code": "2020002",
      "player_name": "東妻 純平",
      "player_name_en": "Jumpei Azuma",
      "player_no": "57",
      "player_short_name": "東 妻",
      "player_short_name_en": null,
      "player_type": null,
      "runner_rank": null,
      "season": 2021,
      "simple_player_code": "2",
      "team": {
        "code": "2012001",
        "sub_id": "12",
        "name": "横浜DeNAベイスターズ"
      },
      "throwing_style": null,
      "weight": null
    },
    ...
```

#### get team-master by command line

```bash
$ pitchbase team-master --filter="season eq 2021" | jq .
{
  "results": [
    {
      "__c": 1610951278169,
      "__u": 1610951278169,
      "bis_team_code": "1992001",
      "classification": null,
      "disabled": false,
      "division": null,
      "fixed": true,
      "home_stadium_code": null,
      "is_latest": true,
      "league": "P",
      "order": null,
      "organization_code": null,
      "parent_team_code": null,
      "season": 2021,
      "team_code": "1992001",
      "team_formal_name": "千葉ロッテマリーンズ",
      "team_formal_name_en": null,
      "team_initial": "ロ",
      "team_name": "マリーンズ",
      "team_name_e": "Marines",
      "team_name_es": "M",
      "team_name_s": "ロッテ",
      "team_name_tm": [
        "CHI_MAR",
        "MIN_MAR"
      ]
    },
    ...
```


## Python API

```py
from boto3.session import Session
from pitchbase.auth import Auth
from pitchbase import Pitchbase
import json


client = Session().client("secretsmanager")
response = client.get_secret_value(
    SecretId='stg_pitchbase_auth_info'
)
data = json.loads(response.get("SecretString"))

auth = Auth(
    endpoint=data.get("endpoint"),
    organization_code=data.get("organization_code"),
    username=data.get("username"),
    password=data.get("password"),
    grant_type=data.get("grant_type"),
)
pitchbase = Pitchbase(auth=auth)
team_master = pitchbase.get_team_master(filter="season eq 2021")
print(team_master)
```


## Installation

```sh
$ pip install git+https://${YDB_GITHUB_TOKEN}:x-oauth-basic@github.dena.jp/AI/pitchbase@vX.X.X
```

or

```
$ pip install git+ssh://git@github.dena.jp/AI/pitchbase@vX.X.X
```

## CI

### install test package

```
$ ./scripts/ci.sh install
```

### test

```
$ ./scripts/ci.sh run-test
```

flake8 and black and pytest.

### release pypi

```
$ ./scripts/ci.sh release
```

git tag and pypi release.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.dena.jp/AI/pitchbase",
    "name": "pitchbase",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pitchbase tool aws",
    "author": "Hiroshi Toyama",
    "author_email": "toyama0919@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dd/77/d9ec296306fcbe2f85b02c742deb0100759955c452442e1134d8f645ad64/pitchbase-0.13.1.tar.gz",
    "platform": null,
    "description": "# pitchbase\n\n[![PyPI version](https://badge.fury.io/py/pitchbase.svg)](https://badge.fury.io/py/pitchbase)\n[![Build Status](https://secure.travis-ci.org/toyama0919/pitchbase.png?branch=master)](http://travis-ci.org/toyama0919/pitchbase)\n\nCommand Line utility for pitchbase.\n\nSupport python3 only.\n\n## Settings\n\n### config file($HOME/.pitchbase)\n\n```yaml\ndefault:\n  host: stg-ap.pitchbase.jp\n  organization_code: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n  username: hiroshi.toyama\n  password: xxxxxxxxxx\n  grant_type: xxxxxxxxxx\n```\n\n### environment variables\n\n```sh\nexport PITCHBASE_HOST=stg-ap.pitchbase.jp\nexport PITCHBASE_ORGANIZATION_CODE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nexport PITCHBASE_USERNAME=hiroshi.toyama\nexport PITCHBASE_PASSWORD=xxxxxxxxxx\nexport PITCHBASE_GRANT_TYPE=xxxxxxxxxx\n```\n\n## Examples\n\n#### get pitch-data by command line\n\n```bash\n$ pitchbase pitch-data --filter=\"game_id eq '2021051427'\" | jq .\n{\n  \"results\": [\n    {\n      \"1b_code\": \"2019007\",\n      \"2b_code\": \"2020065\",\n      \"3b_code\": \"2021049\",\n      \"__c\": 1620982019374,\n      \"__u\": 1621089404671,\n      \"_id\": \"17bb26ebcb7c07aa1caedef7f4e1342a_2021051427_011010101\",\n      ...\n\n```\n\n#### get movie-angle by command line\n\n```bash\n$ pitchbase movie-angle --filter=\"game_id eq '2021080527'\" | jq .\n{\n  \"results\": [\n    {\n      \"__c\": 1628685058185,\n      \"__u\": 1628688147039,\n      \"_id\": \"6113c3021bf476531525d8b5\",\n      ...\n```\n\n#### get game-schedule by command line\n\n```bash\npitchbase game-schedule --filter=\"game_id eq '2021080527'\" | jq .\n{\n  \"results\": [\n    {\n      \"__c\": 1628160045124,\n      \"__u\": 1628259411117,\n      ...\n```\n\n#### get trackman record by command line\n\n```bash\npitchbase trackman-record --filter=\"game_id eq '2021051427'\" | jq .\n{\n  \"results\": [\n    {\n      \"__c\": 1628160045124,\n      \"__u\": 1628259411117,\n      ...\n```\n\n#### get player-master by command line\n\n```bash\npitchbase player-master --filter=\"team.code eq 2012001\" | jq .\n{\n  \"results\": [\n    {\n      \"__c\": 1610950983947,\n      \"__u\": 1615180733457,\n      \"affiliation_history\": null,\n      \"batting\": \"R\",\n      \"birthday\": 20010703,\n      \"birthplace\": null,\n      \"blood_type\": \"AB\",\n      \"disabled\": false,\n      \"draft_year\": \"2019\",\n      \"ebis_code\": null,\n      \"face_file\": \"https://stg-www.pitchbase.jp/img/profile/2021/2012001/2020002.jpg\",\n      \"fixed\": true,\n      \"height\": null,\n      \"is_latest\": true,\n      \"join_date\": null,\n      \"join_scene\": null,\n      \"join_year\": null,\n      \"last_game_date\": null,\n      \"leave_date\": null,\n      \"note\": null,\n      \"order\": null,\n      \"organization_code\": null,\n      \"pitching\": \"R\",\n      \"player_code\": \"2020002\",\n      \"player_name\": \"\u6771\u59bb\u3000\u7d14\u5e73\",\n      \"player_name_en\": \"Jumpei Azuma\",\n      \"player_no\": \"57\",\n      \"player_short_name\": \"\u6771\u3000\u59bb\",\n      \"player_short_name_en\": null,\n      \"player_type\": null,\n      \"runner_rank\": null,\n      \"season\": 2021,\n      \"simple_player_code\": \"2\",\n      \"team\": {\n        \"code\": \"2012001\",\n        \"sub_id\": \"12\",\n        \"name\": \"\u6a2a\u6d5c\uff24\uff45\uff2e\uff21\u30d9\u30a4\u30b9\u30bf\u30fc\u30ba\"\n      },\n      \"throwing_style\": null,\n      \"weight\": null\n    },\n    ...\n```\n\n#### get team-master by command line\n\n```bash\n$ pitchbase team-master --filter=\"season eq 2021\" | jq .\n{\n  \"results\": [\n    {\n      \"__c\": 1610951278169,\n      \"__u\": 1610951278169,\n      \"bis_team_code\": \"1992001\",\n      \"classification\": null,\n      \"disabled\": false,\n      \"division\": null,\n      \"fixed\": true,\n      \"home_stadium_code\": null,\n      \"is_latest\": true,\n      \"league\": \"P\",\n      \"order\": null,\n      \"organization_code\": null,\n      \"parent_team_code\": null,\n      \"season\": 2021,\n      \"team_code\": \"1992001\",\n      \"team_formal_name\": \"\u5343\u8449\u30ed\u30c3\u30c6\u30de\u30ea\u30fc\u30f3\u30ba\",\n      \"team_formal_name_en\": null,\n      \"team_initial\": \"\u30ed\",\n      \"team_name\": \"\u30de\u30ea\u30fc\u30f3\u30ba\",\n      \"team_name_e\": \"Marines\",\n      \"team_name_es\": \"M\",\n      \"team_name_s\": \"\u30ed\u30c3\u30c6\",\n      \"team_name_tm\": [\n        \"CHI_MAR\",\n        \"MIN_MAR\"\n      ]\n    },\n    ...\n```\n\n\n## Python API\n\n```py\nfrom boto3.session import Session\nfrom pitchbase.auth import Auth\nfrom pitchbase import Pitchbase\nimport json\n\n\nclient = Session().client(\"secretsmanager\")\nresponse = client.get_secret_value(\n    SecretId='stg_pitchbase_auth_info'\n)\ndata = json.loads(response.get(\"SecretString\"))\n\nauth = Auth(\n    endpoint=data.get(\"endpoint\"),\n    organization_code=data.get(\"organization_code\"),\n    username=data.get(\"username\"),\n    password=data.get(\"password\"),\n    grant_type=data.get(\"grant_type\"),\n)\npitchbase = Pitchbase(auth=auth)\nteam_master = pitchbase.get_team_master(filter=\"season eq 2021\")\nprint(team_master)\n```\n\n\n## Installation\n\n```sh\n$ pip install git+https://${YDB_GITHUB_TOKEN}:x-oauth-basic@github.dena.jp/AI/pitchbase@vX.X.X\n```\n\nor\n\n```\n$ pip install git+ssh://git@github.dena.jp/AI/pitchbase@vX.X.X\n```\n\n## CI\n\n### install test package\n\n```\n$ ./scripts/ci.sh install\n```\n\n### test\n\n```\n$ ./scripts/ci.sh run-test\n```\n\nflake8 and black and pytest.\n\n### release pypi\n\n```\n$ ./scripts/ci.sh release\n```\n\ngit tag and pypi release.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Command Line utility for pitchbase.",
    "version": "0.13.1",
    "project_urls": {
        "Homepage": "https://github.dena.jp/AI/pitchbase"
    },
    "split_keywords": [
        "pitchbase",
        "tool",
        "aws"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd77d9ec296306fcbe2f85b02c742deb0100759955c452442e1134d8f645ad64",
                "md5": "4fa9478aceb41af6b3295d8084ae579d",
                "sha256": "cc5aa8c9e5cc526c952701a89ea791201601bd173195243cdfa002348b4c4f51"
            },
            "downloads": -1,
            "filename": "pitchbase-0.13.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4fa9478aceb41af6b3295d8084ae579d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9123,
            "upload_time": "2024-08-26T23:14:24",
            "upload_time_iso_8601": "2024-08-26T23:14:24.033933Z",
            "url": "https://files.pythonhosted.org/packages/dd/77/d9ec296306fcbe2f85b02c742deb0100759955c452442e1134d8f645ad64/pitchbase-0.13.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-26 23:14:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pitchbase"
}
        
Elapsed time: 0.39453s