def fetch_url(url, method='<STR_LIT:GET>', user_agent='<STR_LIT>', timeout=SOCKET_TIMEOUT):
sock = httplib2.Http(timeout=timeout)<EOL>request_headers = {<EOL>'<STR_LIT>': user_agent,<EOL>'<STR_LIT>': '<STR_LIT>'}<EOL>try:<EOL><INDENT>headers, raw = sock.request(url, headers=request_headers, method=method)<EOL><DEDENT>except:<EOL><INDENT>raise OEmbedHTTPException('<STR_LIT>' % url)<EOL><DEDENT>return headers, raw<EOL>
Fetch response headers and data from a URL, raising a generic exception
for any kind of failure.