@@ -64,16 +64,21 @@ def __init__(self, token, netloc, path):
6464 self .token , self .netloc , self .organizer = token , netloc , path [1 :]
6565
6666 def get_addresses (self ) -> list [str ]:
67- r = get (
68- f"https://{ self .netloc } /api/v1/organizers/{ self .organizer } /customers/" ,
69- headers = {"Authorization" : f"Token { self .token } " },
70- )
71- r .raise_for_status ()
72- return [
73- c ["email" ].lower ()
74- for c in r .json ()["results" ]
75- if c ["is_active" ] and c ["is_verified" ]
76- ]
67+ addresses = []
68+ url = f"https://{ self .netloc } /api/v1/organizers/{ self .organizer } /customers/"
69+ while True :
70+ r = get (url , headers = {"Authorization" : f"Token { self .token } " })
71+ r .raise_for_status ()
72+ json_data = r .json ()
73+ addresses .extend ([
74+ c ["email" ].lower ()
75+ for c in json_data ["results" ]
76+ if c ["is_active" ] and c ["is_verified" ]
77+ ])
78+ if not json_data ["next" ]:
79+ break
80+ url = json_data ["next" ]
81+ return addresses
7782
7883
7984def determine_address_source (src_url : str ) -> AddressSource :
@@ -89,13 +94,13 @@ def determine_address_source(src_url: str) -> AddressSource:
8994
9095
9196def process_mail (
92- smtp_conn : SMTP ,
93- address_source : AddressSource ,
94- sender_address : str ,
95- default_to : str ,
96- default_reply_to : str ,
97- valid_sender_patterns : list [str ],
98- mail : bytes ,
97+ smtp_conn : SMTP ,
98+ address_source : AddressSource ,
99+ sender_address : str ,
100+ default_to : str ,
101+ default_reply_to : str ,
102+ valid_sender_patterns : list [str ],
103+ mail : bytes ,
99104):
100105 email_parser = BytesParser ()
101106 mail_data = email_parser .parsebytes (mail )
0 commit comments