Started using VK API V 5.84

This commit is contained in:
Manuel Cortez 2018-09-03 09:43:33 -05:00
parent 314a615b68
commit d45bfb0eeb
2 changed files with 7 additions and 7 deletions

View File

@ -181,7 +181,8 @@ class postController(object):
if len(self.images) < index-1:
log.exception("Error in loading image {0} in a list with {1} images".format(index, len(self.images)))
return
url = self.get_photo_url(self.images[index]["photo"], 604)
# Get's photo URL.
url = self.get_photo_url(self.images[index]["photo"], "x")
if url != "":
img = requests.get(url)
image = wx.ImageFromStream(cStringIO.StringIO(requests.get(url).content))
@ -194,12 +195,11 @@ class postController(object):
output.speak(_(u"Loaded photo {0} of {1}").format(index+1, len(self.images)))
return
def get_photo_url(self, photo, size=1080):
possible_sizes = [1280, 604, 130, 75]
def get_photo_url(self, photo, size="x"):
url = ""
for i in possible_sizes:
if photo.has_key("photo_{0}".format(i,)) and i == size:
url = photo["photo_{0}".format(i,)]
for i in photo["sizes"]:
if i["type"] == size:
url = i["url"]
break
return url

View File

@ -8,7 +8,7 @@ class vkObject(object):
def __init__(self):
self.api_key = keys.keyring.get_api_key()
self.api_version = 5.69
self.api_version = 5.84
log.debug("Created vkSession using VK API Version %s" % (self.api_version,))
def login(self, user, password):