I am trying to return all the data extensions within my org, and within the same script return a list from all the columns by looping through the results of from step 1.
Here is a sample of my code:
import ET_Client
try:
debug = False
stubObj = ET_Client.ET_Client(False, debug)
# Get all of the DataExtensions in an Account - This works
print('>>> Get all of the DataExtensions in an Account')
de = ET_Client.ET_DataExtension()
de.auth_stub = stubObj
de.props = ["CustomerKey"]
de.search_filter = {'Property' : 'IsSendable','SimpleOperator' : 'equals','Value' : 'True'}
getResponse = de.get()
#de.search_filter = {'Property' : 'IsSendable','SimpleOperator' : 'equals','Value' : 'True'}
extract = getResponse.results
list2 = []
for item in extract:
list2.append(item[2])
print(list2)
# list2 now has all my customers keys , which I pass to a Second API Call
for x in list2:
de_columns = ET_Client.ET_DataExtension_Column()
de_columns.props = ["CustomerKey"]
de_columns.search_filter = {'Property' : 'CustomerKey','SimpleOperator' : 'equals','Value' : x}
getResponse2 = de_columns.get()
print(getResponse2.results)
except Exception as e:
print('Caught exception: ' + str(e.message))
print(e)
It works until I try looping the results of the second API and I get this error:
File "GetAllDEs.py", line 45, in getResponse2 = de_columns.get() File "/anaconda/lib/python3.6/site-packages/FuelSDK/objects.py", line 234, in get obj = ET_Get(self.auth_stub, self.obj, self.props, self.search_filter) File "/anaconda/lib/python3.6/site-packages/FuelSDK/rest.py", line 145, in init auth_stub.refresh_token() AttributeError: 'NoneType' object has no attribute 'refresh_token'
Not sure where to go from here. I will appreciate any pointers on this.