Skip to main content

SDK for Ekispert API

Project description

駅すぱあと API SDK for Python

駅すぱあと APIをPythonから利用するためのSDKです。

インストール

pip でインストールします。

pip install ekispert

初期化

初期化時には、駅すぱあと APIのAPIキーを指定します。APIキーはトライアル申し込みより取得してください。

from ekispert.client import Ekispert

client = Ekispert("YOUR_API_KEY")

駅情報の取得

駅情報取得APIを実行します。検索条件、結果は駅情報 - 駅すぱあと API Documents 駅データ・経路検索のWebAPIを参照してください。

query = client.stationQuery()
query.code = 22828
points = query.execute()
assert len(points) == 1
assert points[0].station.name == '東京'
assert points[0].geo_point.lati_d == 35.678083
assert points[0].prefecture.name == '東京都'
assert points[0].prefecture.code == 13

駅簡易情報の取得

駅簡易情報APIを実行します。検索条件、結果は駅簡易情報 - 駅すぱあと API Documents 駅データ・経路検索のWebAPIを参照してください。

query = client.stationLightQuery()
query.name = '東京'
points = query.execute()
assert len(points) > 0
assert points[0].station.name == '東京'
assert points[0].prefecture.name == '東京都'
assert points[0].prefecture.code == 13

平均待ち時間探索

平均待ち時間探索APIを実行します。検索条件、結果は平均待ち時間探索 - 駅すぱあと API Documents 駅データ・経路検索のWebAPIを参照してください。

query = client.searchCoursePlainQuery()
query.from_ = 25077
query.to = 29090
courses = query.execute()
assert len(courses) > 0
assert courses[0].routes[0] is not None
assert courses[0].prices[0].kind == "ChargeSummary"
assert courses[0].prices[0].one_way == 2530
assert courses[0].prices[0].round == 5060

定期券の払い戻し計算

定期券の払い戻し計算APIを実行します。検索条件、結果は定期券の払い戻し計算 - 駅すぱあと API Documents 駅データ・経路検索のWebAPIを参照してください。

query = client.courseRepaymentQuery()
query.serializeData = '1,true'
query.checkEngineVersion = False
query.serializeData = 'VkV4QaECp9nIAsMCpgEz76YDpgEz76UEkcIBQwAAAAKmATPvpQPKAQECAQMBBAEHAQgBCgIPQv9_EKX_9xSRpVjVBZfBAqVYj8ECpVjVwQKlWXvBAqVZLMECpVkPwQKlWvHBAqVXwAaSwwEBAgEDxwGlWFoCDQMPBQMGRDk0NlQHBAgDwwEBAgEDxgGmAAIwMwIVAxYFAwcGCAUHksUBpgEz76gDpQJfBKUCZgUACADGAaYBM||oAgEDpQJwBKUCcQUACAAIksQEAQUBB6RtCAHGAgEEAgUBBgEHpQEvCAIJksEDAcMBAQIBAwEPkcUBkwABAgKSwwEAAgADAMMBAQIBAwEDksMBAAIAAwDDAQECAQMBBJIAAQWSAAA*--T3221233232319:F332112212000:A23121141:--88eed71f6168dfe5ab30b8cc5e938621dd3806a7--0--0--0--284'
results = query.execute()
assert results['repayment_list'] is not None
assert results['teiki_route'] is not None
assert results['repayment_list'].repayment_date is not None
assert results['repayment_list'].repayment_tickets is not None
assert results['repayment_list'].repayment_tickets[0].fee_price_value is not None
assert results['teiki_route'].section_separator is not None
assert results['teiki_route'].teiki_route_sections is not None
assert results['teiki_route'].teiki_route_sections[0].points is not None
assert results['teiki_route'].teiki_route_sections[0].points[0].station.name is not None
assert results['teiki_route'].teiki_route_sections[0].points[0].prefecture is not None

ライセンス

MITライセンスです。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ekispert-0.1.7.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ekispert-0.1.7-py3-none-any.whl (101.2 kB view details)

Uploaded Python 3

File details

Details for the file ekispert-0.1.7.tar.gz.

File metadata

  • Download URL: ekispert-0.1.7.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ekispert-0.1.7.tar.gz
Algorithm Hash digest
SHA256 66c9135d4a620cc32717d2fa304b220702ac68ada3d101ee25f73a2fceb56e5a
MD5 7d859ddee41a344f2d82cd2ca32c7cae
BLAKE2b-256 ecbd2eda4df66f051cb7a003b2d195b1cd2b037bd0eb081182219555a67d9fe8

See more details on using hashes here.

File details

Details for the file ekispert-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: ekispert-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 101.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ekispert-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7473779940994b945c875aa3468374de39e7e59dcc052718204ee67021cf946d
MD5 cb29ef38e6499046914c9ce489e6847b
BLAKE2b-256 5651c9695dac36eab096ed2cd50f80f478aa4831c0e4f1d7e2f91b2d74f1c668

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page