mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 12:21:58 +00:00
zephyr_mirror: Rewrite to use the API.
(imported from commit 6d3bce15eb045f28897abb6ddcdbea8e10629a7d)
This commit is contained in:
@@ -4,6 +4,7 @@ import urllib
|
||||
import simplejson
|
||||
from urllib2 import HTTPError
|
||||
import time
|
||||
import traceback
|
||||
|
||||
class HumbugAPI():
|
||||
def __init__(self, email, api_key, verbose=False, site="https://app.humbughq.com"):
|
||||
@@ -33,8 +34,9 @@ class HumbugAPI():
|
||||
max_message_id = None
|
||||
while True:
|
||||
try:
|
||||
options["first"] = "0"
|
||||
options["last"] = str(last_received)
|
||||
if max_message_id is not None:
|
||||
options["first"] = "0"
|
||||
options["last"] = str(max_message_id)
|
||||
messages = self.get_messages(options)
|
||||
except HTTPError, e:
|
||||
# 502/503 typically means the server was restarted; sleep
|
||||
@@ -42,7 +44,9 @@ class HumbugAPI():
|
||||
if self.verbose:
|
||||
print "HTTP Error getting zephyrs; trying again soon."
|
||||
print e
|
||||
print traceback.format_exc()
|
||||
time.sleep(1)
|
||||
continue
|
||||
except Exception, e:
|
||||
# For other errors, just try again
|
||||
print e
|
||||
|
||||
Reference in New Issue
Block a user