mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 18:52:30 -05:00
Make code a bit more defensive and add som logging
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
from flask import current_app
|
||||
import requests
|
||||
|
||||
|
||||
def confirm_subscription(confirmation_request):
|
||||
url = confirmation_request['SubscribeURL']
|
||||
url = confirmation_request.get('SubscribeURL')
|
||||
if not url:
|
||||
current_app.logger.warning("SubscribeURL does not exist or empty")
|
||||
return
|
||||
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except Exception as e:
|
||||
current_app.logger.warning("Response: {}".format(response.text))
|
||||
raise e
|
||||
|
||||
return confirmation_request['TopicArn']
|
||||
|
||||
Reference in New Issue
Block a user