在您的候机楼获得更快的RENFE西班牙列车时刻表

renfe-cli的Python项目详细描述


Quality Gate StatusBuild Status

RENFE时间表cli

在你的终点站上更快的西班牙列车时刻表。工作于 Linux、OSX和Windows python3(请参见 builds)。

changelog

安装

安装python cli包 renfe-cli

$ pip install renfe-cli --upgrade

使用量

$ renfe-cli -h
Usage: renfe-cli [options]

Options:
  -h, --help            show this help message and exit
  -y YEAR, --year=YEAR  year selected to get the timetable from
  -m MONTH, --month=MONTH
                        month of the year to get the timetable from
  -d DAY, --day=DAY     day of the month to get the timetable from
  -o ORIGIN, --origin=ORIGIN
                        from/origin ID of the train station. Use flag '-s
                        <possible station name>' in order to search for IDs
  -t TO, --to=TO        to/destination ID of the train station. Use flag '-s
                        <possible station name>' in order to search for IDs
  -s SEARCH, --search=SEARCH
                        you need to get the stations IDs, searching by names;
                        in order to apply right inputs for origins and/or
                        destinations
  -l LOGGING_LEVEL, --logging-level=LOGGING_LEVEL
                        logging level defaults to warning and possible values
                        are: debug, info, warning, error and critical
  -f LOGGING_FILE, --logging-file=LOGGING_FILE
                        logging file name is required if you want to submit an
                        issue with more information
  -u, --update-config   change your origin and destination stations to
                        defaults when loading this flag

搜索火车站的ID

当使用搜索功能时,它将为您提供 (用作火车站的起点或终点) 类似于要搜索的输入文本。示例:

$ renfe-cli -s sil
Today is: 2019-05-05
Searching stations like: sil
SANESTEVODOSIL: 22003
SANPEDRODOSIL: 22004
SILLA: 64200
SILS: 79202

$ renfe-cli -s barc
Today is: 2019-05-05
Searching stations like: barc
BARCELONA: 97007
BARCELONA(TODAS): BARCE
BARCELONA-ARCDETRIOMF: 78804
BARCELONA-PLAÇADECATALUNYA: 78805
BARCELONA-TORREDELBARO: 78801
BARCELOS: 94024
BARCENA: 14206
CEUTA-BARCO: 99126
ELBARCENAL: 05644
OBARCODEVALDEORRAS: 20211
TANGERMED-BARCO: 99124
TANGERVILLE-BARCO: 99125
VILANOVADELABARCA: 75102

获取时间表

时间表默认为today,从Sils(id是79202)到 Barcelona(id是BARCE):

$ renfe-cli
Today is: 2019-05-05
Searching timetable for date: 2019-05-05
From 79202 to BARCE
=================== TIMETABLE ====================
   Tren / Recorrido  Salida  Llegada      Duración
0          15060 MD    7.23     8.39  1 h. 16 min.
1          15064 MD    8.27     9.39  1 h. 12 min.
2    15806 REGIONAL   10.20    11.39  1 h. 19 min.
3    15808 REGIONAL   11.43    13.09  1 h. 26 min.
4          15070 MD   12.27    13.39  1 h. 12 min.
5    15810 REGIONAL   13.33    14.52  1 h. 19 min.
6          15090 MD   14.27    15.39  1 h. 12 min.
7    15812 REGIONAL   15.39    17.09  1 h. 30 min.
8          15072 MD   16.57    18.09  1 h. 12 min.
9    15814 REGIONAL   17.39    18.55  1 h. 16 min.
10         15018 MD   18.06    19.18  1 h. 12 min.
11         15918 MD   18.57    20.09  1 h. 12 min.
12         15074 MD   19.45    20.55  1 h. 10 min.
13   15848 REGIONAL   20.01    21.09   1 h. 8 min.
14   15850 REGIONAL   20.59    22.19  1 h. 20 min.
15   15822 REGIONAL   21.38    22.55  1 h. 17 min.
==================================================

这与:

$ renfe-cli -y 2019 -m 5 -d 5 -o 79202 -t BARCE
Today is: 2019-05-05
Searching timetable for date: 2019-05-05
From 79202 to BARCE
=================== TIMETABLE ====================
   Tren / Recorrido  Salida  Llegada      Duración
0          15060 MD    7.23     8.39  1 h. 16 min.
1          15064 MD    8.27     9.39  1 h. 12 min.
2    15806 REGIONAL   10.20    11.39  1 h. 19 min.
3    15808 REGIONAL   11.43    13.09  1 h. 26 min.
4          15070 MD   12.27    13.39  1 h. 12 min.
5    15810 REGIONAL   13.33    14.52  1 h. 19 min.
6          15090 MD   14.27    15.39  1 h. 12 min.
7    15812 REGIONAL   15.39    17.09  1 h. 30 min.
8          15072 MD   16.57    18.09  1 h. 12 min.
9    15814 REGIONAL   17.39    18.55  1 h. 16 min.
10         15018 MD   18.06    19.18  1 h. 12 min.
11         15918 MD   18.57    20.09  1 h. 12 min.
12         15074 MD   19.45    20.55  1 h. 10 min.
13   15848 REGIONAL   20.01    21.09   1 h. 8 min.
14   15850 REGIONAL   20.59    22.19  1 h. 20 min.
15   15822 REGIONAL   21.38    22.55  1 h. 17 min.
==================================================

更改默认的始发站和/或目的站

为了更改默认的时刻表站点,您只需添加 -ucli中的标志,下次不需要添加 -o-t参数:

$ renfe-cli -o MADRI -t BARCE -u

如果更改默认值,则在 文件~/.renfe_default_stations.json


问题

如果Renfe的网站被更改,或者您发现任何问题或增强功能, 请:create an issue

安装替代方案(获取最新源代码)

如果要安装最新的源代码:

$ pip install git+http://github.com/gerardcl/renfe-cli

$ git clone git://github.com/gerardcl/renfe-cli
$ cd renfe-cli
$ python setup.py install

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在ArrayList中比较数字   java在Kotlin中使异步调用同步   让“Scala编程”junit示例在IntelliJ中工作的java问题   java Servlet侦听器未在ContextListener中设置属性   将Microsoft SQL Server数据库连接到我的Java项目   加载资源时出现java“需要注册工厂”异常   java如何使用POI检查excel中的重复记录?   java如何更改机器生成的代码   java如何确保重写的方法是同步的   用Spring编写Hibernate时的java XML奥秘   java管理mysql数据库中存储的用户权限   java如何运行。来自Javascript的jar方法   java我想在Web应用程序中进行身份验证&对桌面应用程序使用相同的凭据。我该怎么做?