File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ def get_client_from_cookies(
116116 self ,
117117 cookies : dict [str , str ],
118118 ) -> TwitterOpenapiPythonClient :
119- api_key = self .api_key
119+ api_key = self .api_key . copy ()
120120
121121 if cookies .get ("ct0" ):
122122 api_key .update ({"AuthType" : "OAuth2Session" })
@@ -142,15 +142,15 @@ def get_guest_client(self) -> TwitterOpenapiPythonClient:
142142 "GET" ,
143143 "https://twitter.com" ,
144144 redirect = False ,
145- headers = self .browser_headers ,
145+ headers = self .browser_headers . copy () ,
146146 )
147147 cookie = res_1 .headers ._container ["set-cookie" ][1 :]
148148 session .update (self .cookie_normalize (cookie ))
149149 res_2 = http .request (
150150 "GET" ,
151151 "https://twitter.com" ,
152152 redirect = False ,
153- headers = self .browser_headers | {"Cookie" : self .cookie_to_str (session )},
153+ headers = self .browser_headers . copy () | {"Cookie" : self .cookie_to_str (session )},
154154 )
155155
156156 find = re .findall (r'document.cookie="(.*?)";' , res_2 .data .decode ())
@@ -159,7 +159,7 @@ def get_guest_client(self) -> TwitterOpenapiPythonClient:
159159 session .pop ("ct0" )
160160
161161 if not session .get ("gt" ):
162- activate_header = self .browser_headers | {
162+ activate_header = self .browser_headers . copy () | {
163163 "authorization" : "Bearer {}" .format (self .access_token ),
164164 "x-twitter-active-user" : "yes" ,
165165 "x-twitter-client-language" : "en" ,
You can’t perform that action at this time.
0 commit comments