Browse Source

Fixing ktipp lookup wich failed.

JF Burdet 6 years ago
parent
commit
ade04ffd26
1 changed files with 7 additions and 5 deletions
  1. 7 5
      lenny.py

+ 7 - 5
lenny.py

@@ -230,7 +230,7 @@ class SipConnection(object):
                         self._conversation.status = ConversationStatus.READY_TO_TALK
 
             # We must sleep a bit to avoid cpu hog
-            sleep(0.01)
+            sleep(0.05)
             previous_status = self._conversation.status
 
         self.log("Worker is quitting")
@@ -327,7 +327,7 @@ class SipConnection(object):
         self.set_connection_info()
 
         while not self._is_quitting:
-            sleep(0.03)
+            sleep(0.05)
             self._core.iterate()
 
     def request_quit(self):
@@ -396,9 +396,11 @@ class SipConnection(object):
         url = base_url.replace("{$number$}", the_number)
         response = ""
         try:
-            response = urllib2.urlopen(url).read()
-        except urllib2.HTTPError:
-            pass
+            opener = urllib2.build_opener()
+            opener.addheaders = [('User-Agent', 'Mozilla/5.0')]
+            response = opener.open(url).read()
+        except urllib2.HTTPError as e:
+            self.log(" Error during ktipp lookup : url="+url+", exception : "+str(e))
 
         res = "0 Eintr" not in response
         if res: