Skip to main content

pitchbase

PyPI version Build Status

Command Line utility for pitchbase.

Support python3 only.

Settings

config file($HOME/.pitchbase)

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

environment variables

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

$ 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

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

get game-schedule by command line

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

get trackman record by command line

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

get player-master by command line

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

$ 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

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

$ 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.

Metadata

Release files for pitchbase 0.13.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pitchbase 0.13.2
File Size Uploaded Provenance Actions
pitchbase-0.13.2.tar.gz 8.8 kB Without provenance Details for pitchbase-0.13.2.tar.gz

Release files / pitchbase-0.13.2.tar.gz

Download URL pitchbase-0.13.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
60c6ee5a7b22b914423729766944d9a573199be8aeed8db691ec36fedda333dc
BLAKE2b-256 checksum
How to use checksums
6f7a02137aa149e129b14b24c96312bd59c7bdb388d61a74fc19c4f82573f66b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.5

Security for pitchbase 0.13.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page