Skip to content

Commit

Permalink
Merge pull request #7 from mikeckennedy/dev
Browse files Browse the repository at this point in the history
Fixes bug where search for users with listmonk.all_subscribers() cras…
  • Loading branch information
mikeckennedy authored Apr 5, 2024
2 parents dc4d834 + 75cc1f8 commit 7e3a392
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions example_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
subscriber.name = 'Mr. ' + subscriber.name.upper()
subscriber.attribs['rating'] = 7

query = f"subscribers.email = '{email}'"
print("Searching for user with query: ", query)
sub2 = listmonk.subscribers(query)
print(f'Found {len(sub2):,} users with query.')
print(f'Found {sub2[0].name} with email {sub2[0].email}')

# TODO: Choose list IDs from your instance (can be seen in the UI or from the listing above)
to_add = {the_list.id} # Add all the lists here: {1, 7, 11}
remove_from = set() # Same as above
Expand Down
2 changes: 1 addition & 1 deletion listmonk/impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _fragment_of_subscribers(page_num: int, list_id: Optional[int], query_text:
url += f'&list_id={list_id}'

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

resp = httpx.get(url, headers=core_headers, follow_redirects=True)
resp.raise_for_status()
Expand Down

0 comments on commit 7e3a392

Please sign in to comment.