Skip to main content
[![Build Status](https://travis-ci.org/stmcli/stmcli.svg?branch=master)](https://travis-ci.org/stmcli/stmcli)
# stmcli
The unofficial STM CLI client.

stmcli aims to use the data made available by the [Société de transport de Montréal](http://www.stm.info/)
to create an easy to use command line application to access bus/metro informations.

This tool does not use any information of STM real time. It only retrieve the scheduled times for bus.

## Installation

``` pip3 install stmcli ```

(stmcli is only compatible with python3+ and GNU/Linux)

## Usage

```
usage: stmcli [-h] [-b BUS_NUMBER] [-s BUS_STOP_CODE] [-n NUMBER_DEPARTURE]
[-d DATE] [-t TIME] [-m METRO] [-y]

optional arguments:
-h, --help show this help message and exit
-b BUS_NUMBER, --bus-number BUS_NUMBER
# of the bus
-s BUS_STOP_CODE, --bus-stop-code BUS_STOP_CODE
Code of the bus stop
-n NUMBER_DEPARTURE, --number-departure NUMBER_DEPARTURE
The number of departures to print. Only works with
both -b and -s specified
-d DATE, --date DATE specify the date to use when getting Departure times.
Format: aaaammjj
-t TIME, --time TIME specify the time to use when getting Departure times.
Format: HH:MM
-m METRO, --metro METRO
print the metro status for a given line require an
internet connection. Accepted options: green, orange,
yellow, blue and all
-y, --force-update Do not ask before updating
```
### Bus
To get the next departures times you need to specify at least -b and -s which are the bus number and the bus stop code.

For example: ``` stmcli -b 150 -s 52150 ```

would print the next 10 departures times of the bus "150 René-Lévesque EST" at the "du Sussex / René-Lévesque (52150)" bus stop.

If you don't know your bus stop code or your bus number you can specify only -b or -s. specifying only -b will print all of the bus stop and -s alone will print all bus number for this stop code.

By using the -d and/or the -t arguments you can get bus departures times from sometime in the future.

For example: ``` stmcli -b 150 -s 52150 -d 20160328 -t 06:30 ```

Would print almost the same thing as our first example The only exception is that it will print the 10 next departures after 6:30 AM on march 28th 2016.

### Metro
You can also get the current status of the metro with ```-m```.

For example: ``` stmcli -m green ``` will give you the current status of the green line.

## Language

You can switch the output language of stmcli by editing your ```~/.stmcli/lang.txt```. (The file is generated the first time you run stmcli)
The default is english.

Switch to french with: ```echo "fr" > ~/.stmcli/lang.txt```

Switch to english with: ```echo "en" > ~/.stmcli/lang.txt```

## Developper
Some information to generate a new package for local deployment

* python3 setup.py bdist_wheel
* pip3 install stmcli-1.*-py3-none-any.whl --user --upgrade
* Linux user: the stmcli command is available at $HOME/.local/bin/stmcli
* Verify installed is available: TBD

### Investigate database

By default, the database is createdin ~/.stmcli/stm.db as sqlite format.

Useful tool will be sqlitebrowser https://github.com/sqlitebrowser/sqlitebrowser

Metadata

Release files for stmcli 1.2.1

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

Source distribution (sdist)

Source distribution for stmcli 1.2.1
File Size Uploaded Provenance
stmcli-1.2.1.tar.gz 10.1 kB Without provenance Details

Release files / stmcli-1.2.1.tar.gz

Download URL stmcli-1.2.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0c551ce2a268aade7e22b2bcddc523202ca512f2172e5fc6f2cdc4f78ce71b4d
BLAKE2b-256 checksum
How to use checksums
1ad660ac8ed841a3e4a25a974892a70ebd48d20b93649b8906abf42ca8fa737d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Security for stmcli 1.2.1

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.

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