Closed astrikos closed 7 years ago
Hey @astrikos,
I'll be trying this when I find the time. Thanks so far :)
I tested this with a small script with the measurement ID from the Issue #43.
Steps to reproduce:
ifdown eth0
ifup eth0
After 5., this output is generated:
DEBUG:atlas-stream:Disconnected from RIPE Atlas Stream
DEBUG:atlas-stream:Reconnected to RIPE Atlas Stream
DEBUG:atlas-stream:Trying to attach to existed subscriptions
DEBUG:atlas-stream:Subscribing to {'buffering': False, 'stream_type': 'result', 'msm': 4412911}
DEBUG:atlas-stream:Subscribed to subscription: {'buffering': False, 'stream_type': 'result', 'msm': 4412911}
After that, the streaming continues! Awesome! So this solves #43.
Will this go into 1.3.1?
@astrikos You still need to include this patch. Almost forgot :)
--- stream.py 2016-12-08 16:27:22.057539631 +0100
+++ stream.py 2016-12-08 16:27:11.669539432 +0100
@@ -56,7 +56,7 @@
def on_atlas_subscribed(self, *args):
LOG.debug("Subscribed to subscription: {}".format(args[0]))
- hash_object = hashlib.sha1(str(args[0]))
+ hash_object = hashlib.sha1(str(args[0]).encode('utf-8'))
hex_dig = hash_object.hexdigest()
self.SUBSCRIPTIONS[hex_dig] = args[0]
else you will get
File "/home/jgroeger/.virtualenvs/project/lib/python3.5/site-packages/ripe/atlas/cousteau/stream.py", line 59, in on_atlas_subscribed
hash_object = hashlib.sha1(str(args[0]))
TypeError: Unicode-objects must be encoded before hashing
okay covered that, with which subscription did you caused that? for a simple subscription in py2.7 it worked okay for me.
Those are a lot of coveralls reports :O
@astrikos I'm working on Python 3. Sure it works fine on Python 2 since there, the distinction between bytes and string it not that strict.
Python 3: https://repl.it/EmSt/0 Python 2: https://repl.it/EmSv/0
Onnce you explicitly encode the string as bytes it works with both versions of Python.
Right, and since this file is not covered by any tests I missed it for py3. That's the reason also coveralls complains, there is no tests so the more we write to file the coverage drops. Anyway, I will try to write some tests as soon as I find some time. I am merging that now.
Hi @JonasGroeger, this is an attempt to solve your issue #43. Could you clone and checkout to this branch and give it a try after you install using
python setup.py install
. It would also be useful if you enable logging on the beginning of your script with something like:This way you can see if you if and when you are disconnecting. Let me know if that works for you so I can merge and make a new release soon.