Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.campaigns() TypeError: 'type' object is not iterable #77

Open
Esnilg opened this issue Apr 7, 2022 · 4 comments
Open

client.campaigns() TypeError: 'type' object is not iterable #77

Esnilg opened this issue Apr 7, 2022 · 4 comments

Comments

@Esnilg
Copy link

Esnilg commented Apr 7, 2022

hello

when i run

cs = CreateSend(auth)

clients = cs.clients()
campaign_ids = cs.clients()

for cl in clients:
print("Client: %s" % cl.Name)
client = Client(auth, cl.ClientID)
print("- Campaigns:")
for cm in client.campaigns():
print(" - %s" % cm.Subject)
print(" - %s" % cm.CampaignID)

i have this issue

File "C:\Users\eguevara\AppData\Local\Temp/ipykernel_17348/3998498663.py", line 1, in
for i in client.campaigns():

TypeError: 'type' object is not iterable

@ghost
Copy link

ghost commented Jun 17, 2022

I had the same issue. An older installation with createsend pip 6.1.2 module works well, with createsend 7.0.0 the same code doesn't work anymore. According to the release notes:

Breaking: 'client.campaigns' now returned an object to support pagination (use .Results to get the array of campaigns)

for cm in client.campaigns().Results:

This works !

@Mingzhao-Lin
Copy link

It's happening to me as well. Looks like this wrapper isn't updated. Anyone lucky in acquiring list of campaignIds?

@ghost
Copy link

ghost commented Jan 24, 2023

It's happening to me as well. Looks like this wrapper isn't updated. Anyone lucky in acquiring list of campaignIds?

As said, use .Results

for cl in clients:
client = Client({'api_key': ''}, cl.ClientID)
for cm in client.campaigns().Results:
campaign = Campaign({'api_key': ''}, cm.CampaignID)
cx=campaign.summary()

@Mingzhao-Lin
Copy link

Mingzhao-Lin commented Jan 24, 2023

It's happening to me as well. Looks like this wrapper isn't updated. Anyone lucky in acquiring list of campaignIds?

As said, use .Results

for cl in clients: client = Client({'api_key': ''}, cl.ClientID) for cm in client.campaigns().Results: campaign = Campaign({'api_key': ''}, cm.CampaignID) cx=campaign.summary()

Hi Thanks speedy! Turns out it's because i used a differnt funciton to get client:

auth = (username, password)
...
client = Client(auth, cl.ClientID)

changed it to client = Client({'api_key': ''}, cl.ClientID) and now it's working

Thanks for the headsup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants