From e4045cc5b19432393c07e1270dbf5082c692d3c7 Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Tue, 9 Apr 2024 14:11:55 +0200 Subject: [PATCH] Exit cleanly when no args --- instagram_locations/instagram_locations.py | 6 ++++++ instagram_locations/version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/instagram_locations/instagram_locations.py b/instagram_locations/instagram_locations.py index fe5b7a4..1adc4bb 100644 --- a/instagram_locations/instagram_locations.py +++ b/instagram_locations/instagram_locations.py @@ -34,6 +34,9 @@ def get_instagram_locations(lat, lng, cookie): except json.decoder.JSONDecodeError: print(f"Failed to get location data for {lat_long}: please check you have a valid cookie") return [] + except requests.exceptions.JSONDecodeError: + print(f"Failed to get location data for {lat_long}: please check you have a valid cookie") + return [] if not isinstance(locations, dict): print(f"Got invalid response for {lat_long}") @@ -227,6 +230,9 @@ def main(): if args.date is not None: date_var = "?max_id=" + encode_date(args.date) + if args.lat is None or args.lng is None: + sys.exit(1) + locations = get_fuzzy_locations(float(args.lat), float(args.lng), cookie, sigma=sigma) for i in locations: diff --git a/instagram_locations/version.py b/instagram_locations/version.py index 10b6026..ff88f34 100644 --- a/instagram_locations/version.py +++ b/instagram_locations/version.py @@ -3,7 +3,7 @@ _MAJOR = "1" _MINOR = "5" # On main and in a nightly release the patch should be one ahead of the last # released build. -_PATCH = "1" +_PATCH = "2" # This is mainly for nightly builds which have the suffix ".dev$DATE". See # https://semver.org/#is-v123-a-semantic-version for the semantics. _SUFFIX = ""