def _callbackWrapper(self, callback, result): """ Wraps the callback, so there will be no concurrent write-operatons on the COOKIEFILE """ HTTPCookies.save() callback(result)
def run(self): """ refresh the coookie """ HTTPCookies.clear(self.skarphed.getUrl(without_proto=True)) try: answer = urllib2.urlopen(self.request) plaintext = answer.read() # Line is obviously unnescessary, but a good debugging point :) result = json.loads(plaintext) except urllib2.URLError: result = {"error": "HTTP-ERROR"} if result.has_key("error"): logging.debug("Could not reestablish session") else: gobject.idle_add(self._callbackWrapper, self.callback)