fix listmonk authentication
This commit is contained in:
parent
270200cac3
commit
f84d0238f0
1 changed files with 6 additions and 6 deletions
|
|
@ -92,23 +92,23 @@ def add_email(email):
|
|||
|
||||
def delete_bounced_emails():
|
||||
url = settings.LISTMONK_API + 'bounces'
|
||||
auth = (settings.LISTMONK_USER, settings.LISTMONK_PASSWORD)
|
||||
r = requests.get(url + '?per_page=10000', auth=auth).json()
|
||||
auth = get_auth(headers)
|
||||
r = requests.get(url + '?per_page=10000', headers=headers, auth=auth).json()
|
||||
ids = [sub['subscriber_id'] for sub in r['data']['results']]
|
||||
url = settings.LISTMONK_API + 'subscribers'
|
||||
for id in ids:
|
||||
r = requests.delete(url + '?id=%s' % id, auth=auth).json()
|
||||
r = requests.delete(url + '?id=%s' % id, headers=headers, auth=auth).json()
|
||||
if not r.get("data"):
|
||||
print(id)
|
||||
|
||||
|
||||
def delete_blacklisted_emails():
|
||||
url = settings.LISTMONK_API + 'subscribers'
|
||||
auth = (settings.LISTMONK_USER, settings.LISTMONK_PASSWORD)
|
||||
r = requests.get(url + '?per_page=10000', auth=auth).json()
|
||||
auth = get_auth(headers)
|
||||
r = requests.get(url + '?per_page=10000', headers=headers, auth=auth).json()
|
||||
ids = [u['id'] for u in r['data']['results'] if u['status'] == 'blocklisted']
|
||||
for id in ids:
|
||||
r = requests.delete(url + '?id=%s' % id, auth=auth).json()
|
||||
r = requests.delete(url + '?id=%s' % id, headers=headers, auth=auth).json()
|
||||
if not r.get("data"):
|
||||
print(id)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue