@@ -22,11 +22,19 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
22
22
token_refresh_endpoint = "https://api.x.com/2/oauth2/token"
23
23
)
24
24
25
- tweet = Tweet (
26
- authenticator = auth ,
27
- account_id = config ["account_id" ],
28
- start_time = datetime .strptime (config ['start_time' ], DATE_FORMAT ),
29
- )
25
+ # Parse start_time if provided, otherwise streams will use their defaults
26
+ start_time = None
27
+ if "start_time" in config :
28
+ start_time = datetime .strptime (config ['start_time' ], DATE_FORMAT )
29
+
30
+ tweet_kwargs = {
31
+ "authenticator" : auth ,
32
+ "account_id" : config ["account_id" ]
33
+ }
34
+ if start_time :
35
+ tweet_kwargs ["start_time" ] = start_time
36
+
37
+ tweet = Tweet (** tweet_kwargs )
30
38
31
39
tags_kwargs = {
32
40
"authenticator" : auth ,
@@ -35,8 +43,8 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
35
43
}
36
44
37
45
# Add start_time only if provided in config
38
- if " start_time" in config :
39
- tags_kwargs ["start_time" ] = datetime . strptime ( config [ ' start_time' ], DATE_FORMAT )
46
+ if start_time :
47
+ tags_kwargs ["start_time" ] = start_time
40
48
41
49
# Add tags_frequent_extractions if provided in config
42
50
if "tags_frequent_extractions" in config :
@@ -56,11 +64,14 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
56
64
parent = tweet
57
65
)
58
66
59
- promoted_tweet_active = PromotedTweetActive (
60
- authenticator = auth ,
61
- account_id = config ['account_id' ],
62
- start_time = datetime .strptime (config ['start_time' ], DATE_FORMAT ),
63
- )
67
+ promoted_tweet_active_kwargs = {
68
+ "authenticator" : auth ,
69
+ "account_id" : config ['account_id' ]
70
+ }
71
+ if start_time :
72
+ promoted_tweet_active_kwargs ["start_time" ] = start_time
73
+
74
+ promoted_tweet_active = PromotedTweetActive (** promoted_tweet_active_kwargs )
64
75
65
76
promoted_tweet_billing = PromotedTweetBilling (
66
77
authenticator = auth ,
@@ -74,11 +85,14 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
74
85
parent = promoted_tweet_active
75
86
)
76
87
77
- space = Space (
78
- authenticator = auth ,
79
- account_id = config ['account_id' ],
80
- start_time = datetime .strptime (config ['start_time' ], DATE_FORMAT )
81
- )
88
+ space_kwargs = {
89
+ "authenticator" : auth ,
90
+ "account_id" : config ['account_id' ]
91
+ }
92
+ if start_time :
93
+ space_kwargs ["start_time" ] = start_time
94
+
95
+ space = Space (** space_kwargs )
82
96
83
97
return [
84
98
Account (authenticator = auth , account_id = config ["account_id" ]),
0 commit comments