From 00cf364f73fa67329a59bfd5a6bcd4dab0731c86 Mon Sep 17 00:00:00 2001 From: Askill Date: Fri, 25 Feb 2022 23:35:10 +0100 Subject: [PATCH] fixed path --- .gitignore | 1 + main.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b6e4761..0a4689f 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,4 @@ dmypy.json # Pyre type checker .pyre/ +cache/*/*.json diff --git a/main.py b/main.py index 09c3eb1..e16c55f 100644 --- a/main.py +++ b/main.py @@ -58,7 +58,7 @@ if __name__ == "__main__": create_dir_if_not_exists(f"./cache/{country}") url = f"http://www.insecam.org/en/bycountry/{country}/?page=" - ips_file = f"./{country}/ips.json" + ips_file = f"./cache/{country}/ips.json" links = list(set(main(url,range(1,20), header_values={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}))) links = [l for l in links if l is not None] @@ -67,12 +67,12 @@ if __name__ == "__main__": locs = get_locations(ips_file) - locs_file = f"./{country}/locs.json" + locs_file = f"./cache/{country}/locs.json" save_to_json(locs_file, locs) locs = load_content(locs_file) df = pd.DataFrame.from_dict({"id": [x["query"] for x in locs], "lat": [x["lat"] for x in locs], "lon": [x["lon"] for x in locs]}) fig = px.scatter_geo(df,lat='lat',lon='lon', hover_name="id", scope="europe", center={"lat": 50.7385,"lon": 25.3198}) - fig.update_layout(title = 'World map', title_x=0.5) + fig.update_layout(title = f'Webcams in {country}', title_x=0.5) fig.show() \ No newline at end of file