File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,8 +160,12 @@ def url(self) -> str:
160160 location_codes = "" .join (
161161 f"-{ location_code .upper ()} " for location_code in self ._filter_ip_locations
162162 )
163+ username = self .proxy_username
164+ suffix = "-rotate"
165+ if username .endswith (suffix ):
166+ username = username [: - len (suffix )]
163167 return (
164- f"http://{ self . proxy_username } { location_codes } -rotate :{ self .proxy_password } "
168+ f"http://{ username } { location_codes } { suffix } :{ self .proxy_password } "
165169 f"@{ self .domain_name } :{ self .proxy_port } /"
166170 )
167171
Original file line number Diff line number Diff line change @@ -91,3 +91,15 @@ def test_to_requests_dict__with_multiple_location_filters(self):
9191 "http" : "http://user-DE-US-rotate:password@p.webshare.io:80/" ,
9292 "https" : "http://user-DE-US-rotate:password@p.webshare.io:80/" ,
9393 }
94+
95+ def test_to_requests_dict__with_rotate_suffix_in_username (self ):
96+ proxy_config = WebshareProxyConfig (
97+ proxy_username = "user-rotate" , proxy_password = "password"
98+ )
99+
100+ request_dict = proxy_config .to_requests_dict ()
101+
102+ assert request_dict == {
103+ "http" : "http://user-rotate:password@p.webshare.io:80/" ,
104+ "https" : "http://user-rotate:password@p.webshare.io:80/" ,
105+ }
You can’t perform that action at this time.
0 commit comments