Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
# radiation data from stations in Poland based on https://mapa.paa.gov.pl/ from requests_html import HTMLSession session = HTMLSession() import json # get session and render html site r = session.get('https://mapa.paa.gov.pl/') r.html.render(sleep=1, keep_page=True, scrolldown=1) # find all CSS 'div' Selectors results = r.html.find('div') # list of attributes for all CSS Selectors list_attrs = [] for item in results: list_attrs.append(item.attrs) # list of dictionares with keys and values for "miasto", "wartosc" and 'status of radiation stations radiation_list = [] for item in list_attrs: if "('station',)" in str(item): radiation_dict = { 'miasto': item['data-nazwa'], 'wartosc': "{:.3f}".format(float(item['data-wartosc']) / 1000), 'status': item['data-status'], } radiation_list.append(radiation_dict) # load data to json format jsonString = json.dumps(radiation_list, ensure_ascii=False, sort_keys=True) print(jsonString) # write data to file with open('promieniowanie.json', 'w') as f: json.dump(radiation_list, f, ensure_ascii=False)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)