spansh.py: misc fixes
This commit is contained in:
parent
15a8deca65
commit
07a6db2595
1 changed files with 5 additions and 11 deletions
16
spansh.py
16
spansh.py
|
@ -41,7 +41,7 @@ def getOldStations():
|
||||||
}
|
}
|
||||||
json = requests.post(APIURLS["stations"], params).json()
|
json = requests.post(APIURLS["stations"], params).json()
|
||||||
|
|
||||||
ret =""
|
ret = ""
|
||||||
for station in json["results"]:
|
for station in json["results"]:
|
||||||
if args.short:
|
if args.short:
|
||||||
ret += "{}\n".format(station["system_name"])
|
ret += "{}\n".format(station["system_name"])
|
||||||
|
@ -61,7 +61,7 @@ def getOldStationsInSystem(system):
|
||||||
}
|
}
|
||||||
json = requests.post(APIURLS["stations"], params).json()
|
json = requests.post(APIURLS["stations"], params).json()
|
||||||
|
|
||||||
ret =""
|
ret = ""
|
||||||
for station in json["results"]:
|
for station in json["results"]:
|
||||||
if args.short:
|
if args.short:
|
||||||
ret += "{}\n".format(station["name"])
|
ret += "{}\n".format(station["name"])
|
||||||
|
@ -122,7 +122,7 @@ SORT = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out =""
|
out = None
|
||||||
if args.subcommand == "nearestsystem":
|
if args.subcommand == "nearestsystem":
|
||||||
out = getNearestSystem(args.coordinate)
|
out = getNearestSystem(args.coordinate)
|
||||||
elif args.subcommand == "oldstations":
|
elif args.subcommand == "oldstations":
|
||||||
|
@ -130,12 +130,6 @@ elif args.subcommand == "oldstations":
|
||||||
out = getOldStationsInSystem(args.system)
|
out = getOldStationsInSystem(args.system)
|
||||||
else:
|
else:
|
||||||
out = getOldStations()
|
out = getOldStations()
|
||||||
else:
|
|
||||||
parser.print_usage(sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if out == "":
|
print(out)
|
||||||
sys.exit(3)
|
sys.exit(0)
|
||||||
else:
|
|
||||||
print(out)
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
Loading…
Reference in a new issue