async-westjr-0.0.1
توضیحات
Handling of train operation information of JR West, a railroad company in Japan
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | async-westjr-0.0.1 |
| نام | async-westjr |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | midorichaan |
| ایمیل نویسنده | furandorusukaret.jp@gmail.com |
| آدرس صفحه اصلی | https://github.com/midorichaan/async-westjr |
| آدرس اینترنتی | https://pypi.org/project/async-westjr/ |
| مجوز | Unlicense |
# Async-WestJR
JR西日本列車走行位置 非公式API Pythonライブラリ (async版)
* 列車走行位置取得 (/api/v3/LINE.json)
* 路線名取得 (/api/v3/area_AREA_master.json)
* 駅一覧取得 (/api/v3/LINE_st.json)
* 運行情報取得 (/api/v3/area_AREA_trafficinfo.json)
* 列車走行位置駅名,列車停車種別の変換
## Notice
* 動作を完全には確認していません.
## Installation
```console
$ python3 -m pip install git+https://github.com/midorichaan/async-westjr.git
$ python3 -m pip install git+ssh://git@github.com/midorichaan/async-westjr
```
## Usage
```python
import async_westjr
jr = async_westjr.WestJR()
# あらかじめ area や line をセットする
jr = async_westjr.WestJR(line="kobesanyo", area="kinki")
```
### Example
#### 列車走行位置取得
```python
coro = await jr.get_trains()
print(coro)
# {'update': '2021-03-31T08:14:34.313Z', 'trains': [{'no': '798T', 'pos': '0414_0415', ...```
```
#### 駅一覧取得
```python
coro = await jr.get_stations()
print(coro)
# {'stations': [{'info': {'name': '新大阪', 'code': '0415', 'stopTrains': [1, 2, 5], 'typeNotice': None, ...
```
#### 路線一覧取得
```python
coro = await jr.get_lines()
print(coro)
# {'lines': {'ako': {'name': '赤穂線', 'range': '相生〜播州赤穂', 'st': ...
```
#### 運行情報取得
```Python
coro = await jr.get_traffic_info()
print(coro)
# {'lines': {}, 'express': {}}
```
#### エリア名一覧表示
```python
print(jr.areas)
# ['hokuriku', 'kinki', 'okayama', 'hiroshima', 'sanin']
```
#### 路線名一覧表示
```python
print(jr.lines)
# ['hokuriku', 'kobesanyo', 'hokurikubiwako', 'kyoto', 'ako', 'kosei', 'kusatsu', 'nara', 'sagano', 'sanin1', 'sanin2', 'osakahigashi', 'takarazuka']
```
#### 駅に停車する種別を id から名称に変換する
```python
station = (await jr.get_stations(line="kyoto"))["stations"][0]
print(station["info"]["name"])
print(jr.convert_stopTrains(station["info"]["stopTrains"]))
# 山科
# ['新快速', '快速', '特急']
```
#### 列車走行位置の場所を前駅と次駅の名前に変換する
```python
train = (await jr.get_trains(line="kobesanyo"))["trains"]
tr = train[0]
prev, next = jr.convert_pos(train=tr)
print(prev)
# 塚本
```
نیازمندی
| مقدار | نام |
|---|---|
| - | aiohttp |
نحوه نصب
نصب پکیج whl async-westjr-0.0.1:
pip install async-westjr-0.0.1.whl
نصب پکیج tar.gz async-westjr-0.0.1:
pip install async-westjr-0.0.1.tar.gz