Skip to content

Instantly share code, notes, and snippets.

@brianv0
Last active January 8, 2016 20:40
Show Gist options
  • Save brianv0/19e7ec3a61f1da3dae9a to your computer and use it in GitHub Desktop.
Save brianv0/19e7ec3a61f1da3dae9a to your computer and use it in GitHub Desktop.
sconsinstaller
import httplib
#import logging
#logging.basicConfig(level=logging.DEBUG)
#httplib.HTTPConnection.debuglevel = 1
def getData( request ):
'''queries the database for the requested information'''
servername = "glast-ground.slac.stanford.edu"
conn = httplib.HTTPConnection( servername )
conn.putrequest( 'GET', request )
conn.putheader( 'Accept', 'text/html' )
conn.endheaders()
response = conn.getresponse()
if response.status != 200:
msg = "The requested data or package was not available on the server: "
print msg + response.reason
sys.exit()
else:
data = response.read()
conn.close()
return data
path = "/SConsInstaller/db.jsp?function=versions&package=ScienceTools&versionType=Release"
print getData(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment