@@ -68,12 +68,18 @@ def spec(self, *args, **kwargs) -> ConnectorSpecification:
68
68
@staticmethod
69
69
def _prepare_stream_args (config : Mapping [str , Any ]) -> Mapping [str , Any ]:
70
70
"""Converts an input configure to stream arguments"""
71
- credentials = config .get ("credentials" ) or config
72
-
73
- access_token = credentials ["access_token" ]
74
- secret = credentials .get ("secret" ) or credentials .get ("environment" , {}).get ("secret" )
75
- app_id = int (credentials .get ("app_id" , 0 ) or credentials .get ("environment" , {}).get ("app_id" , 0 ))
76
- advertiser_id = int (credentials .get ("advertiser_id" , 0 ) or credentials .get ("environment" , {}).get ("advertiser_id" , 0 ))
71
+ credentials = config .get ("credentials" )
72
+ if credentials :
73
+ # used for new config format
74
+ access_token = credentials ["access_token" ]
75
+ secret = credentials .get ("secret" )
76
+ app_id = int (credentials .get ("app_id" , 0 ))
77
+ advertiser_id = int (credentials .get ("advertiser_id" , 0 ))
78
+ else :
79
+ access_token = config ["access_token" ]
80
+ secret = config .get ("environment" , {}).get ("secret" )
81
+ app_id = int (config .get ("environment" , {}).get ("app_id" , 0 ))
82
+ advertiser_id = int (config .get ("environment" , {}).get ("advertiser_id" , 0 ))
77
83
78
84
return {
79
85
"authenticator" : TiktokTokenAuthenticator (access_token ),
0 commit comments