Created
June 5, 2012 16:34
-
-
Save dudarev/2876115 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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