Tokens will not expire in 24 hours

This commit is contained in:
Manuel Cortez 2018-12-14 15:30:44 -06:00
parent 4b5d271ab4
commit ba72e80279

View File

@ -2,7 +2,9 @@
import keys import keys
import logging import logging
import vk_api import vk_api
import core
from vk_api.audio import VkAudio from vk_api.audio import VkAudio
import core
log = logging.getLogger("vkSessionHandler") log = logging.getLogger("vkSessionHandler")
class vkObject(object): class vkObject(object):
@ -12,12 +14,13 @@ class vkObject(object):
def login(self, user, password, filename): def login(self, user, password, filename):
log.debug("Logging in vk using user/password authentication") log.debug("Logging in vk using user/password authentication")
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename) # token = core.requestAuth(user, password)
self.session_object.auth() self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename)
self.session_object.auth(token_only=True)
self.client = self.session_object.get_api() self.client = self.session_object.get_api()
# self.client = API(s, v=self.api_version) # self.client = API(s, v=self.api_version)
log.debug("Getting tokens for 24 hours...") log.debug("Getting tokens for 24 hours...")
self.client.account.getProfileInfo() # info = self.client.account.getProfileInfo()
# Add session data to the application statistics. # Add session data to the application statistics.
self.client.stats.trackVisitor() self.client.stats.trackVisitor()
self.client_audio = VkAudio(self.session_object) self.client_audio = VkAudio(self.session_object)