Workarround for urllib3 bug
authorft
Mon, 09 Dec 2013 16:38:20 +0100
changeset 10b97aad470500
parent 9 cc99197f1e08
child 11 dc877520743b
Workarround for urllib3 bug
src/OsecFS.py
     1.1 --- a/src/OsecFS.py	Mon Dec 09 15:19:05 2013 +0100
     1.2 +++ b/src/OsecFS.py	Mon Dec 09 16:38:20 2013 +0100
     1.3 @@ -222,12 +222,15 @@
     1.4      remote_ip = netaddr.IPNetwork("%s/%s" %(netifaces.ifaddresses("eth0")[2][0]["addr"], netifaces.ifaddresses("eth0")[2][0]["netmask"]))[1]
     1.5      
     1.6      url_options = {"type" : type, "message" : message }
     1.7 -    url = ("http://%s:8090/notification?%s" %(remote_ip, urllib.urlencode(url_options)))
     1.8 +    
     1.9 +    # BUG in urllib3. Starting / is missing -> workarround use 2 of them -.- 
    1.10 +    url = ("http://%s:8090//notification?%s" %(remote_ip, urllib.urlencode(url_options)))
    1.11      
    1.12      LOG.debug ("Send notification to \"%s\"" %(url, ))
    1.13      
    1.14      try:
    1.15 -        response = httpPool.request_encode_body('GET', url, retries = 0)
    1.16 +        #response = httpPool.request_encode_body('GET', url, retries = 0)
    1.17 +        response = httpPool.request("GET", url, retries = 0)
    1.18      except:
    1.19          LOG.error("Remote host not reachable")
    1.20          LOG.error ("Exception: %s" %(sys.exc_info()[0]))