Started using VK API V 5.84
This commit is contained in:
parent
314a615b68
commit
d45bfb0eeb
@ -181,7 +181,8 @@ class postController(object):
|
|||||||
if len(self.images) < index-1:
|
if len(self.images) < index-1:
|
||||||
log.exception("Error in loading image {0} in a list with {1} images".format(index, len(self.images)))
|
log.exception("Error in loading image {0} in a list with {1} images".format(index, len(self.images)))
|
||||||
return
|
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 != "":
|
if url != "":
|
||||||
img = requests.get(url)
|
img = requests.get(url)
|
||||||
image = wx.ImageFromStream(cStringIO.StringIO(requests.get(url).content))
|
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)))
|
output.speak(_(u"Loaded photo {0} of {1}").format(index+1, len(self.images)))
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_photo_url(self, photo, size=1080):
|
def get_photo_url(self, photo, size="x"):
|
||||||
possible_sizes = [1280, 604, 130, 75]
|
|
||||||
url = ""
|
url = ""
|
||||||
for i in possible_sizes:
|
for i in photo["sizes"]:
|
||||||
if photo.has_key("photo_{0}".format(i,)) and i == size:
|
if i["type"] == size:
|
||||||
url = photo["photo_{0}".format(i,)]
|
url = i["url"]
|
||||||
break
|
break
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class vkObject(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.api_key = keys.keyring.get_api_key()
|
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,))
|
log.debug("Created vkSession using VK API Version %s" % (self.api_version,))
|
||||||
|
|
||||||
def login(self, user, password):
|
def login(self, user, password):
|
||||||
|
Loading…
Reference in New Issue
Block a user