Skip to content

Commit

Permalink
Merge pull request #321 from davidteather/nightly
Browse files Browse the repository at this point in the history
Deprecation Warnings
  • Loading branch information
davidteather authored Nov 9, 2020
2 parents 65687d3 + c2bf51f commit 347e60a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
5 changes: 4 additions & 1 deletion TikTokApi/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import requests
import time
from urllib.parse import urlencode, quote

from .utilities import update_messager
from .browser import browser


Expand All @@ -28,6 +28,9 @@ def __init__(self, **kwargs):
"Chrome/86.0.4240.111 Safari/537.36"
)

if not kwargs.get("ignore_version", False):
update_messager()

# Get Browser Params
b = browser("newParam", newParams=True, **kwargs)

Expand Down
30 changes: 30 additions & 0 deletions TikTokApi/utilities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import subprocess
import sys
import pkg_resources

def update_messager():
#if not check("TikTokApi"):
# Outdated
# print("TikTokApi package is outdated, please consider upgrading! \n(You can suppress this by setting ignore_version to True while calling the TikTok Api class)")

if not check_future_deprecation():
print("Your version of python is going to be deprecated, for future updates upgrade to 3.7+")

def check(name):

latest_version = str(subprocess.run([sys.executable, '-m', 'pip', 'install', '{}==random'.format(name)], capture_output=True, text=True))
latest_version = latest_version[latest_version.find('(from versions:')+15:]
latest_version = latest_version[:latest_version.find(')')]
latest_version = latest_version.replace(' ','').split(',')[-1]

current_version = str(subprocess.run([sys.executable, '-m', 'pip', 'show', '{}'.format(name)], capture_output=True, text=True))
current_version = current_version[current_version.find('Version:')+8:]
current_version = current_version[:current_version.find('\\n')].replace(' ','')

if latest_version == current_version:
return True
else:
return False

def check_future_deprecation():
return sys.version_info >= (3, 7)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setuptools.setup(
name="TikTokApi",
packages=["TikTokApi"],
version="3.6.2",
version="3.6.3",
license="MIT",
description="The Unofficial TikTok API Wrapper in Python 3.",
author="David Teather",
Expand Down

0 comments on commit 347e60a

Please sign in to comment.