Skip to content

Commit b2660ed

Browse files
committed
Add version checking in debug mode
1 parent c506e2d commit b2660ed

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

vk_api/utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Copyright (C) 2017
88
"""
99

10+
from __future__ import print_function
11+
1012
try:
1113
import simplejson as json
1214
except ImportError:
@@ -109,6 +111,22 @@ def enable_debug_mode(vk_session, print_content=False):
109111

110112
import requests
111113

114+
from . import __version__
115+
116+
pypi_version = requests.get(
117+
'https://pypi.python.org/pypi/vk_api/json'
118+
).json()['info']['version']
119+
120+
if __version__ != pypi_version:
121+
print()
122+
print('######### MODULE IS NOT UPDATED!!1 ##########')
123+
print()
124+
print('Installed vk_api version is:', __version__)
125+
print('PyPI vk_api version is:', pypi_version)
126+
print()
127+
print('######### MODULE IS NOT UPDATED!!1 ##########')
128+
print()
129+
112130
class DebugHTTPAdapter(requests.adapters.HTTPAdapter):
113131
def send(self, request, **kwargs):
114132
start = time.time()

0 commit comments

Comments
 (0)