|
|
@ -261,7 +261,7 @@ class NotifyGitter(NotifyBase):
|
|
|
|
|
|
|
|
|
|
|
|
def _fetch(self, url, payload=None, method='GET'):
|
|
|
|
def _fetch(self, url, payload=None, method='GET'):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Wrapper to POST
|
|
|
|
Wrapper to request object
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
@ -305,11 +305,7 @@ class NotifyGitter(NotifyBase):
|
|
|
|
# period.
|
|
|
|
# period.
|
|
|
|
wait = (self.ratelimit_reset - now).total_seconds() + 0.5
|
|
|
|
wait = (self.ratelimit_reset - now).total_seconds() + 0.5
|
|
|
|
|
|
|
|
|
|
|
|
# Always call throttle before any remote server i/o is made; for AWS
|
|
|
|
# Always call throttle before any remote server i/o is made
|
|
|
|
# time plays a huge factor in the headers being sent with the payload.
|
|
|
|
|
|
|
|
# So for AWS (SNS) requests we must throttle before they're generated
|
|
|
|
|
|
|
|
# and not directly before the i/o call like other notification
|
|
|
|
|
|
|
|
# services do.
|
|
|
|
|
|
|
|
self.throttle(wait=wait)
|
|
|
|
self.throttle(wait=wait)
|
|
|
|
|
|
|
|
|
|
|
|
# fetch function
|
|
|
|
# fetch function
|
|
|
@ -328,8 +324,9 @@ class NotifyGitter(NotifyBase):
|
|
|
|
NotifyGitter.http_response_code_lookup(r.status_code)
|
|
|
|
NotifyGitter.http_response_code_lookup(r.status_code)
|
|
|
|
|
|
|
|
|
|
|
|
self.logger.warning(
|
|
|
|
self.logger.warning(
|
|
|
|
'Failed to send Gitter POST to {}: '
|
|
|
|
'Failed to send Gitter {} to {}: '
|
|
|
|
'{}error={}.'.format(
|
|
|
|
'{}error={}.'.format(
|
|
|
|
|
|
|
|
method,
|
|
|
|
url,
|
|
|
|
url,
|
|
|
|
', ' if status_str else '',
|
|
|
|
', ' if status_str else '',
|
|
|
|
r.status_code))
|
|
|
|
r.status_code))
|
|
|
@ -361,8 +358,8 @@ class NotifyGitter(NotifyBase):
|
|
|
|
|
|
|
|
|
|
|
|
except requests.RequestException as e:
|
|
|
|
except requests.RequestException as e:
|
|
|
|
self.logger.warning(
|
|
|
|
self.logger.warning(
|
|
|
|
'Exception received when sending Gitter POST to {}: '.
|
|
|
|
'Exception received when sending Gitter {} to {}: '.
|
|
|
|
format(url))
|
|
|
|
format(method, url))
|
|
|
|
self.logger.debug('Socket Exception: %s' % str(e))
|
|
|
|
self.logger.debug('Socket Exception: %s' % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
# Mark our failure
|
|
|
|
# Mark our failure
|
|
|
|