Skip to content

Commit

Permalink
Exit cleanly when no args
Browse files Browse the repository at this point in the history
  • Loading branch information
loganwilliams committed Apr 9, 2024
1 parent 38419cd commit e4045cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions instagram_locations/instagram_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion instagram_locations/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_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 = ""
Expand Down

0 comments on commit e4045cc

Please sign in to comment.