Commit 1ecfda0cab47ce4700a8dfb7a92126ff2d653741

Authored by Sergio Oliveira
1 parent 654ef3bd

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 2 import urlparse
3 3 import requests
  4 +import logging
4 5  
5 6 from django.conf import settings
6 7  
... ... @@ -18,7 +19,8 @@ def subscribe(listname, address):
18 19 url = get_url(listname)
19 20 try:
20 21 requests.put(url, timeout=TIMEOUT, data={'address': address})
21   - except requests.exceptions.RequestException:
  22 + except:
  23 + logging.exception('Unable to subscribe user')
22 24 return False
23 25 return True
24 26  
... ... @@ -27,7 +29,8 @@ def unsubscribe(listname, address):
27 29 url = get_url(listname)
28 30 try:
29 31 requests.delete(url, timeout=TIMEOUT, data={'address': address})
30   - except requests.exceptions.RequestException:
  32 + except:
  33 + logging.exception('Unable to unsubscribe user')
31 34 return False
32 35 return True
33 36  
... ... @@ -52,7 +55,8 @@ def address_lists(address, description=''):
52 55  
53 56 try:
54 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 60 return []
57 61  
58 62 return lists.json()
... ...