def post_to_identica(url, data, header, tries=0): while True: try: logp("POST to Identi.ca: Trying to connect to %s" % url) request = urllib_request.Request(url, data, headers=header) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise
def get(url, tries=0): while True: try: logp("GET: Trying to connect to %s" % url) request = urllib_request.Request(url) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise
def post_to_identica(url, data, header, tries = 0): while True: try: logp("POST to Identi.ca: Trying to connect to %s" % url) request = urllib_request.Request(url, data, headers=header) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise
def get(url, tries = 0): while True: try: logp("GET: Trying to connect to %s" % url) request = urllib_request.Request(url) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise
def post(url, params, header, tries=0): while True: try: logp("POST: Trying to connect to %s" % url) data = urllib_parse.urlencode(params) request = urllib_request.Request(url, data, headers=header) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise
def post(url, params, header, tries = 0): while True: try: logp("POST: Trying to connect to %s" % url) data = urllib_parse.urlencode(params) request = urllib_request.Request(url, data, headers=header) response = urllib_request.urlopen(request) return response.read() except: # urllib_error.HTTPError or urllib_error.URLError tries += 1 sleep(.33) if tries > 3: raise