Skip to content

Instantly share code, notes, and snippets.

@dudarev
Created June 5, 2012 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudarev/2876115 to your computer and use it in GitHub Desktop.
Save dudarev/2876115 to your computer and use it in GitHub Desktop.
from lxml import objectify
from exceptions import QueryRequired
def request(query=None, file_name=None):
"""
Makes a request to CGHub web service or gets data from a file.
Returns parsed Response object.
"""
if query==None and file_name==None:
raise QueryRequired
results = []
if query==None and file_name:
results = objectify.fromstring(open(file_name, 'r').read())
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment