mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Get offset from local user timezone as opposed to call get_settings on twitter's side
This commit is contained in:
parent
768f0bc396
commit
6da81a9734
@ -140,6 +140,9 @@ class Session(base.baseSession):
|
|||||||
self.twitter_v2 = tweepy.Client(consumer_key=appkeys.twitter_api_key, consumer_secret=appkeys.twitter_api_secret, access_token=self.settings["twitter"]["user_key"], access_token_secret=self.settings["twitter"]["user_secret"])
|
self.twitter_v2 = tweepy.Client(consumer_key=appkeys.twitter_api_key, consumer_secret=appkeys.twitter_api_secret, access_token=self.settings["twitter"]["user_key"], access_token_secret=self.settings["twitter"]["user_secret"])
|
||||||
if verify_credentials == True:
|
if verify_credentials == True:
|
||||||
self.credentials = self.twitter.verify_credentials()
|
self.credentials = self.twitter.verify_credentials()
|
||||||
|
self.settings["twitter"]["user_name"] = self.credentials.screen_name
|
||||||
|
self.db["user_name"] = self.credentials.screen_name
|
||||||
|
self.db["user_id"] = self.credentials.id_str
|
||||||
self.logged = True
|
self.logged = True
|
||||||
log.debug("Logged.")
|
log.debug("Logged.")
|
||||||
self.counter = 0
|
self.counter = 0
|
||||||
@ -271,15 +274,9 @@ class Session(base.baseSession):
|
|||||||
# @_require_login
|
# @_require_login
|
||||||
def get_user_info(self):
|
def get_user_info(self):
|
||||||
""" Retrieves some information required by TWBlue for setup."""
|
""" Retrieves some information required by TWBlue for setup."""
|
||||||
f = self.twitter.get_settings()
|
offset = time.timezone if (time.localtime().tm_isdst == 0) else time.altzone
|
||||||
sn = f["screen_name"]
|
offset = offset*-1
|
||||||
self.settings["twitter"]["user_name"] = sn
|
self.db["utc_offset"] = offset
|
||||||
self.db["user_name"] = sn
|
|
||||||
self.db["user_id"] = self.twitter.get_user(screen_name=sn).id
|
|
||||||
try:
|
|
||||||
self.db["utc_offset"] = f["time_zone"]["utc_offset"]
|
|
||||||
except KeyError:
|
|
||||||
self.db["utc_offset"] = -time.timezone
|
|
||||||
# Get twitter's supported languages and save them in a global variable
|
# Get twitter's supported languages and save them in a global variable
|
||||||
#so we won't call to this method once per session.
|
#so we won't call to this method once per session.
|
||||||
if len(application.supported_languages) == 0:
|
if len(application.supported_languages) == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user