def read_url(url): import httpget import socket # THIS AFFECTS SOCKETS GLOBALLY AND SHOULD _NOT_ BE USED!!! timeout_time = socket.getdefaulttimeout() socket.setdefaulttimeout(15) data = httpget.read_url(url) # THIS AFFECTS SOCKETS GLOBALLY AND SHOULD _NOT_ BE USED!!! socket.setdefaulttimeout(timeout_time) return data
def read_url(url, http_headers={}, http_post_data=None): import httpget import socket # THIS AFFECTS SOCKETS GLOBALLY AND SHOULD _NOT_ BE USED!!! timeout_time = socket.getdefaulttimeout() socket.setdefaulttimeout(15) data = httpget.read_url(url, http_headers, http_post_data) # THIS AFFECTS SOCKETS GLOBALLY AND SHOULD _NOT_ BE USED!!! socket.setdefaulttimeout(timeout_time) return data