Skip to content

Instantly share code, notes, and snippets.

@jossef
Last active February 11, 2026 07:42
Show Gist options
  • Select an option

  • Save jossef/4b4fe99155b9bfe84275 to your computer and use it in GitHub Desktop.

Select an option

Save jossef/4b4fe99155b9bfe84275 to your computer and use it in GitHub Desktop.
vorpx (oculus VR enhancements) last version download script
import socket
def download_file_oldschool(host, page, output_file, headers={}):
request = 'GET {page} HTTP/1.1\r\nHost: {host}'.format(page=page, host=host)
for name, value in headers.iteritems():
request += '\r\n{name}: {value}'.format(name=name, value=value)
request += '\r\n\r\n'
try:
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((host, 80))
s.send(request)
with open(output_file, 'wb') as f:
parsed_headers = False
remaining = 0
while True:
data = s.recv(1360)
if not data:
break
if not parsed_headers and '\n\n' in data:
split = data.split('\r\n\r\n')
headers = split[0]
data = split[1]
for line in headers.split('\r\n'):
if line.lower().startswith('content-length'):
content_length = line.split(':')[1].strip()
remaining = int (content_length)
parsed_headers = True
f.write(data)
remaining -= len(data)
print 'remaining', remaining
if remaining <= 0:
break
finally:
s.close()
host = "www.vorpx.com"
page = '/v0/latest/vorpX_Setup.ex_'
output_file = 'vorpx-installer.exe'
headers = {'Authorization' : 'Basic d2Vic2V0dXA6d2ViIzI3NjkyMzcqc2V0dXA='}
download_file_oldschool(host, page, output_file, headers)
print "done"
@stevefan1999

Copy link
Copy Markdown
import http.client, urllib.parse

host = "www.vorpx.com"
page = '/v0/latest/vorpX_Setup.ex_'	
output_file = 'vorpx-installer.exe'
headers = {'Authorization' : 'Basic d2Vic2V0dXA6d2ViIzI3NjkyMzcqc2V0dXA='}
conn = http.client.HTTPConnection(host)
conn.request("GET", page, {}, headers)
response = conn.getresponse()
data = response.read()

with open(output_file, 'wb') as file:
    file.write(data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment