Remove list_stations() and `-S' option - lefrecce - Retrieve information about next trains and stations via lefrecce.it
 (HTM) hg clone https://bitbucket.org/iamleot/lefrecce
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset ccc4a957d06be9a409c654f7411948d52f62226e
 (DIR) parent e2048e252820ed686fda5e16121449a028b02ba3
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri,  8 Mar 2019 14:55:37 
       
       Remove list_stations() and `-S' option
       
       The JSON file used is no longer available.
       
       Diffstat:
        lefrecce.py |  32 --------------------------------
        1 files changed, 0 insertions(+), 32 deletions(-)
       ---
       diff -r e2048e252820 -r ccc4a957d06b lefrecce.py
       --- a/lefrecce.py       Sat Sep 29 20:36:11 2018 +0200
       +++ b/lefrecce.py       Fri Mar 08 14:55:37 2019 +0100
       @@ -58,8 +58,6 @@
                                      '{solution}/info'
        LEFRECCE_LOCATIONS_URL = LEFRECCE_API_URL + '/geolocations/locations?' + \
                                 'name={name}'
       -LEFRECCE_STATIONS_URL = 'http://www.trenitalia.com/cms-file/common/js/' + \
       -                        'themes/trenitalia_2014/001/list_json.js'
        
        
        def print_solution(solution):
       @@ -220,36 +218,12 @@
            return stations
        
        
       -def list_stations():
       -    """List all known stations.
       -
       -    >>> len(list_stations()) > 0
       -    True
       -    """
       -    url = LEFRECCE_STATIONS_URL
       -
       -    sess = requests.Session()
       -    sess.headers['Accept-Language'] = 'en-US'
       -    r = sess.get(url)
       -    j = json.loads(r.text)
       -
       -    stations = set()
       -    for station in j:
       -        stations.add(list(station)[0])
       -
       -    stations = list(stations)
       -    stations.sort()
       -
       -    return stations
       -
       -
        if __name__ == '__main__':
            import argparse
            import sys
        
            ap = argparse.ArgumentParser(
                     description='Retrieve information from lefrecce.it')
       -    ap.add_argument('-S', action='store_true', help='List all stations')
            ap.add_argument('-s', metavar='search_station', type=str)
            ap.add_argument('-o', metavar='origin', type=str,
                            help='origin station')
       @@ -262,12 +236,6 @@
            ap.add_argument('-q', action='store_true', help='silent output')
            args = ap.parse_args()
        
       -    # List all stations and exit
       -    if args.S:
       -        for s in list_stations():
       -            print(s)
       -        sys.exit(0)
       -
            # Search stations and exit
            if args.s:
                for s in search_stations(args.s):