Skip to content

Commit 7e3a392

Browse files
authored
Merge pull request #7 from mikeckennedy/dev
Fixes bug where search for users with listmonk.all_subscribers() cras…
2 parents dc4d834 + 75cc1f8 commit 7e3a392

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

example_client/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
subscriber.name = 'Mr. ' + subscriber.name.upper()
6868
subscriber.attribs['rating'] = 7
6969

70+
query = f"subscribers.email = '{email}'"
71+
print("Searching for user with query: ", query)
72+
sub2 = listmonk.subscribers(query)
73+
print(f'Found {len(sub2):,} users with query.')
74+
print(f'Found {sub2[0].name} with email {sub2[0].email}')
75+
7076
# TODO: Choose list IDs from your instance (can be seen in the UI or from the listing above)
7177
to_add = {the_list.id} # Add all the lists here: {1, 7, 11}
7278
remove_from = set() # Same as above

listmonk/impl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def _fragment_of_subscribers(page_num: int, list_id: Optional[int], query_text:
201201
url += f'&list_id={list_id}'
202202

203203
if query_text:
204-
url += f"&query={urllib.parse.urlencode({'query': query_text})}"
204+
url += f"&{urllib.parse.urlencode({'query': query_text})}"
205205

206206
resp = httpx.get(url, headers=core_headers, follow_redirects=True)
207207
resp.raise_for_status()

0 commit comments

Comments
 (0)