Skip to content

Commit

Permalink
Change: Small changes to the code that retrieves the chart data from …
Browse files Browse the repository at this point in the history
…onionoo to fix an issue with very young relays. => 3.0.3
  • Loading branch information
ralphwetzel authored and ralphwetzel committed Nov 5, 2016
1 parent f58dcff commit e86c349
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion theonionbox/stamp.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20161006|232535
20161105|141353
2 changes: 1 addition & 1 deletion theonionbox/theonionbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import absolute_import
from __future__ import print_function

__version__ = '3.0.2' # stamp will be added later
__version__ = '3.0.3' # stamp will be added later
__description__ = 'The Onion Box: WebInterface to monitor Tor Relays and Bridges'


Expand Down
19 changes: 13 additions & 6 deletions theonionbox/tob/onionoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,26 @@ def published(self):
return None

def _decode_history_object(self, data, name, key):

if data is None:
return None

if name not in data:
KeyError("No History Object named '{}' in chart data.".format(name))
lgr = logging.getLogger('theonionbox')

hist_obj = data[name]
try:
hist_obj = data[name]
except Exception:
# This Exception will be raised if a wrong 'name' was provided while programming
# OR if the relay is so young that there are no historical infos in the onionoo data!
lgr.warn("While decoding Onionoo history data: Key '{}' not found.".format(name))
return None

if key not in hist_obj:
try:
# go = graph objext
go = hist_obj[key]
except Exception:
return None

# go = graph objext
go = hist_obj[key]
result = []

data = go['values']
Expand Down

0 comments on commit e86c349

Please sign in to comment.