moved imports to main function
We import tweetdelete during setup (for version and author retrieval), but don't have toml yet.
This commit is contained in:
parent
4b84373ad4
commit
759306c02f
1 changed files with 16 additions and 16 deletions
|
@ -6,23 +6,23 @@ __copyright__ = "Copyright 2021 Tobias Schmidl"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
|
|
||||||
import os
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
|
|
||||||
import toml
|
|
||||||
import tweepy
|
|
||||||
from xdg import xdg_config_home
|
|
||||||
|
|
||||||
# options
|
|
||||||
twitter_config = toml.load(os.path.join(xdg_config_home(), "twitter.toml"))
|
|
||||||
test_mode = twitter_config["test_mode"] if "test_mode" in twitter_config else False
|
|
||||||
verbose = twitter_config["verbose"] if "verbose" in twitter_config else False
|
|
||||||
days_to_keep = twitter_config["days_to_keep"] if "days_to_keep" in twitter_config else 30
|
|
||||||
tweets_to_save = twitter_config["tweets_to_save"] if "tweets_to_save" in twitter_config else []
|
|
||||||
secrets = twitter_config["secrets"]
|
|
||||||
|
|
||||||
# auth and api
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
import os
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
import toml
|
||||||
|
import tweepy
|
||||||
|
from xdg import xdg_config_home
|
||||||
|
|
||||||
|
# options
|
||||||
|
twitter_config = toml.load(os.path.join(xdg_config_home(), "twitter.toml"))
|
||||||
|
test_mode = twitter_config["test_mode"] if "test_mode" in twitter_config else False
|
||||||
|
verbose = twitter_config["verbose"] if "verbose" in twitter_config else False
|
||||||
|
days_to_keep = twitter_config["days_to_keep"] if "days_to_keep" in twitter_config else 30
|
||||||
|
tweets_to_save = twitter_config["tweets_to_save"] if "tweets_to_save" in twitter_config else []
|
||||||
|
secrets = twitter_config["secrets"]
|
||||||
|
|
||||||
|
# auth and api
|
||||||
auth = tweepy.OAuthHandler(secrets['api_key'], secrets['api_key_secret'])
|
auth = tweepy.OAuthHandler(secrets['api_key'], secrets['api_key_secret'])
|
||||||
auth.set_access_token(secrets['access_token'], secrets['access_token_secret'])
|
auth.set_access_token(secrets['access_token'], secrets['access_token_secret'])
|
||||||
api = tweepy.API(auth)
|
api = tweepy.API(auth)
|
||||||
|
|
Loading…
Reference in a new issue