@@ -20,19 +20,23 @@ def __init__(self):
20
20
is_64bits = sys .maxsize > 2 ** 32
21
21
self .is_windows = False
22
22
osname = platform .system ()
23
+ source_url = "https://www.browserstack.com/local-testing/downloads/binaries/"
24
+ if os .environ .get ('BROWSERSTACK_LOCAL_BIN_URL' ):
25
+ source_url = os .environ .get ('BROWSERSTACK_LOCAL_BIN_URL' )
26
+
23
27
if osname == 'Darwin' :
24
- self .http_path = "https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-darwin-x64"
28
+ self .http_path = source_url + " BrowserStackLocal-darwin-x64"
25
29
elif osname == 'Linux' :
26
30
if self .is_alpine ():
27
- self .http_path = "https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-alpine"
31
+ self .http_path = source_url + " BrowserStackLocal-alpine"
28
32
else :
29
33
if is_64bits :
30
- self .http_path = "https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-linux-x64"
34
+ self .http_path = source_url + " BrowserStackLocal-linux-x64"
31
35
else :
32
- self .http_path = "https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-linux-ia32"
36
+ self .http_path = source_url + " BrowserStackLocal-linux-ia32"
33
37
else :
34
38
self .is_windows = True
35
- self .http_path = "https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal.exe"
39
+ self .http_path = source_url + " BrowserStackLocal.exe"
36
40
37
41
self .ordered_paths = [
38
42
os .path .join (os .path .expanduser ('~' ), '.browserstack' ),
@@ -92,6 +96,9 @@ def download(self, chunk_size=8192, progress_hook=None):
92
96
content_encoding = response .info ().get ('Content-Encoding' , '' )
93
97
gzip_file = gzip .GzipFile (fileobj = response , mode = 'rb' ) if content_encoding .lower () == 'gzip' else None
94
98
99
+ if os .getenv ('BROWSERSTACK_LOCAL_DEBUG_GZIP' ) and gzip_file :
100
+ print ('using gzip in ' + headers ['User-Agent' ])
101
+
95
102
def read_chunk (chunk_size ):
96
103
if gzip_file :
97
104
return gzip_file .read (chunk_size )
0 commit comments