Make use of proxy settings in service.character api stuff
This commit is contained in:
@@ -125,13 +125,12 @@ class PFGlobalPref ( PreferenceView):
|
||||
|
||||
proxy = self.proxySettings.autodetect()
|
||||
|
||||
txt = "Auto-detected: "
|
||||
if len(proxy) == 0:
|
||||
txt += "None"
|
||||
txt = "None"
|
||||
else:
|
||||
txt += proxy
|
||||
txt = proxy
|
||||
|
||||
self.stPSAutoDetected.SetLabel(txt)
|
||||
self.stPSAutoDetected.SetLabel("Auto-detected: " + txt)
|
||||
self.stPSAutoDetected.Disable()
|
||||
|
||||
cChar = service.Character.getInstance()
|
||||
|
||||
@@ -113,17 +113,28 @@ class Character():
|
||||
char = eos.db.getCharacter(charID)
|
||||
return (char.apiID or "", char.apiKey or "")
|
||||
|
||||
def getProxySettings(self):
|
||||
ps = service.settings.ProxySettings.getInstance()
|
||||
if ps.getMode() == 0:
|
||||
return None
|
||||
elif ps.getMode() == 1:
|
||||
return ps.autodetect()
|
||||
elif ps.getMode == 2:
|
||||
return ps.getAddress() + ps.getPort()
|
||||
|
||||
|
||||
def charList(self, charID, userID, apiKey):
|
||||
char = eos.db.getCharacter(charID)
|
||||
try:
|
||||
char.apiID = userID
|
||||
char.apiKey = apiKey
|
||||
return char.apiCharList()
|
||||
return char.apiCharList(proxy = self.getProxySettings())
|
||||
except:
|
||||
return None
|
||||
|
||||
def apiFetch(self, charID, charName):
|
||||
char = eos.db.getCharacter(charID)
|
||||
|
||||
char = eos.db.getCharacter(charID, proxy = self.getProxySettings())
|
||||
char.apiFetch(charName)
|
||||
eos.db.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user