Commit 1ecfda0cab47ce4700a8dfb7a92126ff2d653741
1 parent
654ef3bd
Exists in
master
and in
39 other branches
Logging errors trying to connect to mailmanapi
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
src/accounts/utils/mailman.py
| 1 | 1 | ||
| 2 | import urlparse | 2 | import urlparse |
| 3 | import requests | 3 | import requests |
| 4 | +import logging | ||
| 4 | 5 | ||
| 5 | from django.conf import settings | 6 | from django.conf import settings |
| 6 | 7 | ||
| @@ -18,7 +19,8 @@ def subscribe(listname, address): | @@ -18,7 +19,8 @@ def subscribe(listname, address): | ||
| 18 | url = get_url(listname) | 19 | url = get_url(listname) |
| 19 | try: | 20 | try: |
| 20 | requests.put(url, timeout=TIMEOUT, data={'address': address}) | 21 | requests.put(url, timeout=TIMEOUT, data={'address': address}) |
| 21 | - except requests.exceptions.RequestException: | 22 | + except: |
| 23 | + logging.exception('Unable to subscribe user') | ||
| 22 | return False | 24 | return False |
| 23 | return True | 25 | return True |
| 24 | 26 | ||
| @@ -27,7 +29,8 @@ def unsubscribe(listname, address): | @@ -27,7 +29,8 @@ def unsubscribe(listname, address): | ||
| 27 | url = get_url(listname) | 29 | url = get_url(listname) |
| 28 | try: | 30 | try: |
| 29 | requests.delete(url, timeout=TIMEOUT, data={'address': address}) | 31 | requests.delete(url, timeout=TIMEOUT, data={'address': address}) |
| 30 | - except requests.exceptions.RequestException: | 32 | + except: |
| 33 | + logging.exception('Unable to unsubscribe user') | ||
| 31 | return False | 34 | return False |
| 32 | return True | 35 | return True |
| 33 | 36 | ||
| @@ -52,7 +55,8 @@ def address_lists(address, description=''): | @@ -52,7 +55,8 @@ def address_lists(address, description=''): | ||
| 52 | 55 | ||
| 53 | try: | 56 | try: |
| 54 | lists = requests.get(url, timeout=TIMEOUT, params=params) | 57 | lists = requests.get(url, timeout=TIMEOUT, params=params) |
| 55 | - except requests.exceptions.RequestException: | 58 | + except: |
| 59 | + logging.exception('Unable to list mailing lists') | ||
| 56 | return [] | 60 | return [] |
| 57 | 61 | ||
| 58 | return lists.json() | 62 | return lists.json() |