mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history
This commit is contained in:
@@ -48,7 +48,7 @@ def restrict_ip_sms():
|
|||||||
# Check route of inbound sms (Experimental)
|
# Check route of inbound sms (Experimental)
|
||||||
# Temporary custom header for route security
|
# Temporary custom header for route security
|
||||||
if request.headers.get("X-Custom-forwarder"):
|
if request.headers.get("X-Custom-forwarder"):
|
||||||
current_app.logger.info("X-Custom-forwarder {}".format(request.headers.get("X-Custom-forwarder")))
|
current_app.logger.info("X-Custom-forwarder received")
|
||||||
|
|
||||||
# Check IP of SMS providers
|
# Check IP of SMS providers
|
||||||
if request.headers.get("X-Forwarded-For"):
|
if request.headers.get("X-Forwarded-For"):
|
||||||
|
|||||||
@@ -502,11 +502,22 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
|
|||||||
},
|
},
|
||||||
timeout=60
|
timeout=60
|
||||||
)
|
)
|
||||||
|
current_app.logger.info('send_inbound_sms_to_service sending {} to {}, response {}'.format(
|
||||||
|
inbound_sms_id,
|
||||||
|
inbound_api.url,
|
||||||
|
response.status_code
|
||||||
|
))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
current_app.logger.exception("Exception raised in send_inbound_sms_to_service for service_id: {} and url: {}. "
|
current_app.logger.warning(
|
||||||
"\n{}".format(service_id, inbound_api.url, e))
|
"send_inbound_sms_to_service request failed for service_id: {} and url: {}. exc: {}".format(
|
||||||
|
service_id,
|
||||||
|
inbound_api.url,
|
||||||
|
e
|
||||||
|
)
|
||||||
|
)
|
||||||
if e.response.status_code >= 500:
|
if e.response.status_code >= 500:
|
||||||
try:
|
try:
|
||||||
self.retry(queue=QueueNames.RETRY,
|
self.retry(queue=QueueNames.RETRY,
|
||||||
|
|||||||
Reference in New Issue
Block a user