aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2019-06-21 18:05:48 -0700
committerJordan <me@jordan.im>2019-06-21 18:05:48 -0700
commitfc58403a0187e4c707d46a0f5fe9a80f3852e791 (patch)
tree97ecf19745d0b2d4337f0855c7424c45412a6b5c
parent3bfc4809d0205565103fe76cc0921c6de4b2a90b (diff)
downloadallium-fc58403a0187e4c707d46a0f5fe9a80f3852e791.tar.gz
allium-fc58403a0187e4c707d46a0f5fe9a80f3852e791.zip
readme, relays.py trailing whitespace
-rw-r--r--README.md10
-rw-r--r--tor-metrics/relays.py4
2 files changed, 12 insertions, 2 deletions
diff --git a/README.md b/README.md
index e8c7bf7..e6bc48c 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,16 @@ Network-oriented Tor metrics and statistics made with love (not javascript).
* Sort by ASN, country, and platform
* Respectful Onionoo queries (If-Modified-Since)
+```bash
+# Requirements: python3, jinja2 (pip install jinja2)
+
+git clone https://github.com/tempname1024/tor-metrics.git
+cd tor-metrics/tor-metrics
+python3 generate.py
+
+# Files are written to www/ by default
+```
+
```
TODO:
- Per-relay page generation (display contact, exit policy, etc)
diff --git a/tor-metrics/relays.py b/tor-metrics/relays.py
index 31f4bd9..2c88528 100644
--- a/tor-metrics/relays.py
+++ b/tor-metrics/relays.py
@@ -17,7 +17,7 @@ class Relays:
with open(self.ts_file, 'r') as ts_file:
prev_timestamp = ts_file.read()
try:
- conn = urllib.request.Request(self.url,
+ conn = urllib.request.Request(self.url,
headers={"If-Modified-Since": prev_timestamp})
api_response = urllib.request.urlopen(conn).read()
self.statuscode = urllib.request.urlopen(conn).getcode()
@@ -36,7 +36,7 @@ class Relays:
return(None)
except URLError as e:
return(None)
-
+
json_data = json.loads(api_response.decode('utf-8'))
sorted_json = self.sort_by_bandwidth(json_data)
trimmed_json = self.trim_platform(sorted_json)