Skip to content

Commit

Permalink
Fix compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mDuo13 committed Mar 25, 2022
1 parent 84160d3 commit 9396b25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
21 changes: 12 additions & 9 deletions sayminimal/tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):
self.conf_file = os.path.expanduser(CONF_FILE)
try:
with open(self.conf_file) as f:
self.vals = yaml.load(f)
self.vals = yaml.load(f, Loader=yaml.SafeLoader)
self.MigrateTo3()
except FileNotFoundError:
logging.warning("Couldn't load conf file, opening a new one.")
Expand Down Expand Up @@ -197,14 +197,17 @@ def __init__(self, conf, builder):
tweepy.API.__init__(self, auth)

def GetUrlLen(self):
try:
assert int(time.time()) < int(self.conf.Get("tco_url_len_timestamp")) + URL_LEN_CACHE_TIME
return int(self.conf.Get("tco_url_len"))
except (KeyError, AssertionError):
url_len = self.configuration()["short_url_length"]
self.conf.Set("tco_url_len", url_len)
self.conf.Set("tco_url_len_timestamp", int(time.time()))
return url_len
## Work around tweepy.error.TweepError: Failed to parse JSON payload
## for configuration endpoint.
return 23
# try:
# assert int(time.time()) < int(self.conf.Get("tco_url_len_timestamp")) + URL_LEN_CACHE_TIME
# return int(self.conf.Get("tco_url_len"))
# except (KeyError, AssertionError):
# url_len = self.configuration()["short_url_length"]
# self.conf.Set("tco_url_len", url_len)
# self.conf.Set("tco_url_len_timestamp", int(time.time()))
# return url_len


def GetAppKeys(self):
Expand Down
16 changes: 6 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@

from setuptools import setup

# Convert the markdown readme to ReST using Pandoc
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
long_description = open('README.md').read()
long_description = open('README.md').read()


setup(
name='sayminimal',
version="3.0.0",
version="3.0.2",
description='A minimalist write-only Twitter/Mastodon client.',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/mduo13/sayminimal',
author='mDuo13',
author_email='[email protected]',
Expand All @@ -26,10 +22,10 @@
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: POSIX',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Communications',
],
keywords='twitter mastodon social microblogging',
Expand Down

0 comments on commit 9396b25

Please sign in to comment.