API - Search By Status - Python

Eric535

Member
In the API docs, the Search By Status Endpoint shows "TODO - implement" for the python tab. What does that mean? How come I dont get sample code like I do with the other endpoints and for php?



Screenshot 2023-11-16 at 11.31.18 PM.png




Im trying to search for emails where status = moved. The below shows confirmed but I guess i can change it once i get it working with confirmed. My response = endpoint.get_subscribers(list_uid='zs200q4flg67c', status='confirmed', page=1, per_page=10) line is where i am having the issue. I get Unexpected keyword argument 'status' in method call.

Code:
from setup_api import setup
from mailwizz.endpoint.list_subscribers import ListSubscribers
import json


"""
SETUP THE API
"""
setup()


"""
CREATE THE ENDPOINT
"""
endpoint = ListSubscribers()

"""
Search By Status
"""
response = endpoint.get_subscribers(list_uid='zs200q4flg67c', status='confirmed', page=1, per_page=10)

"""
DISPLAY RESPONSE
"""
print(response.content)

json_data = json.loads(response.text)

data = json.dumps(json_data, indent=4) # Make it pretty

print(data)
 
Hello,
That endpoint is not implemented yet. The PHP SDK is ahead of the other languages SDKs. When the time will allow us, we will tackle also these tasks.

Cosmin
 
Ok. Is there any way of me searching for statuses = moved and then running them through an email verification system?
 
Hello,
Do you mean using the python sdk? You can get them, page by page and based on the status send them to some verification system. Or simply export them as a csv from MW from Lists->All Subscribers->Filters and verify the csv with some email verification service (see EmailListVerify, ZeroBounce, etc..)

Cosmin
 
Hello,
Do you mean using the python sdk? You can get them, page by page and based on the status send them to some verification system. Or simply export them as a csv from MW from Lists->All Subscribers->Filters and verify the csv with some email verification service (see EmailListVerify, ZeroBounce, etc..)

Cosmin
Thats what I ended up doing. Just exporting. I wanted to use the API.
 
I didnt understand your explanation on how to do it in the API. Sorry
This is not implemented yet in python api, but you can try to change get_subscribers endpoint to accept and status param and give a try:

Python:
def get_subscribers(self, list_uid: str, status: str, page=1, per_page=10):
        """
        Get subscribers from a certain mail list
        :param list_uid:
        :param status:
        :param page:
        :param per_page:
        :return:
        """

        client = Client({
            'method': Client.METHOD_GET,
            'url': self.config.get_api_url('lists/{list_uid}/subscribers'.format(list_uid=list_uid)),
            'params_get': {
                'page': page,
                'per_page': per_page,
                'status': status,
            }
        })

        return client.request()
 
Back
Top