@@ -20,19 +20,23 @@ def __init__(self):
2020 is_64bits = sys .maxsize > 2 ** 32
2121 self .is_windows = False
2222 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+
2327 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"
2529 elif osname == 'Linux' :
2630 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"
2832 else :
2933 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"
3135 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"
3337 else :
3438 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"
3640
3741 self .ordered_paths = [
3842 os .path .join (os .path .expanduser ('~' ), '.browserstack' ),
@@ -92,6 +96,9 @@ def download(self, chunk_size=8192, progress_hook=None):
9296 content_encoding = response .info ().get ('Content-Encoding' , '' )
9397 gzip_file = gzip .GzipFile (fileobj = response , mode = 'rb' ) if content_encoding .lower () == 'gzip' else None
9498
99+ if os .getenv ('BROWSERSTACK_LOCAL_DEBUG_GZIP' ) and gzip_file :
100+ print ('using gzip in ' + headers ['User-Agent' ])
101+
95102 def read_chunk (chunk_size ):
96103 if gzip_file :
97104 return gzip_file .read (chunk_size )
0 commit comments