terrasync.py: make HTTPGetter.get() return the HTTPGetCallback.callback ret value
This way, the caller can get access to interesting things from the callback, such as the HTTPResponse object (wrapper for the socket).
This commit is contained in:
parent
b7fc63d896
commit
de4291b851
1 changed files with 9 additions and 5 deletions
|
@ -49,20 +49,24 @@ class HTTPGetter:
|
|||
def doGet(self, httpGetCallback):
|
||||
conn = self.httpConnection
|
||||
request = httpGetCallback
|
||||
self.httpConnection.request("GET", self.parsedBaseUrl.path + request.src, None, self.httpRequestHeaders)
|
||||
self.httpConnection.request("GET",
|
||||
self.parsedBaseUrl.path + request.src,
|
||||
None, self.httpRequestHeaders)
|
||||
httpGetCallback.result = self.httpConnection.getresponse()
|
||||
httpGetCallback.callback()
|
||||
|
||||
return httpGetCallback.callback()
|
||||
|
||||
def get(self, httpGetCallback):
|
||||
|
||||
try:
|
||||
self.doGet(httpGetCallback)
|
||||
res = self.doGet(httpGetCallback)
|
||||
except HTTPException:
|
||||
# try to reconnect once
|
||||
#print("reconnect")
|
||||
self.httpConnection.close()
|
||||
self.httpConnection.connect()
|
||||
self.doGet(httpGetCallback)
|
||||
res = self.doGet(httpGetCallback)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
#################################################################################################################################
|
||||
|
|
Loading…
Add table
Reference in a new issue