-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathpkginfo.py
44 lines (32 loc) · 1.14 KB
/
pkginfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
[Upbit Client]
Please read the official Upbit Client document.
Documents: https://ujhin.github.io/upbit-client-docs/
- Upbit OPEN API Version: 1.3.4
- Author: ujhin
- Email: [email protected]
- GitHub: https://github.com/uJhin
- Official OPEN API Documents: https://docs.upbit.com
- Official Support Email: [email protected]
"""
import logging
import requests
from distutils.version import LooseVersion
def _get_versions(package_name):
url = f"https://pypi.org/pypi/{package_name}/json"
resp = requests.get(url)
data = resp.json()
versions = data["releases"].keys()
return sorted(versions, key=LooseVersion, reverse=True)
PACKAGE_NAME = "upbit-client"
OPEN_API_VERSION = "1.3.4"
CURRENT_VERSION = OPEN_API_VERSION+".1"
RELEASED_VERSION = _get_versions(PACKAGE_NAME)
LATEST_VERSION = RELEASED_VERSION[0]
if LATEST_VERSION != CURRENT_VERSION:
logging.basicConfig(format="[%(levelname)s] %(message)s")
logging.warning(
f"{PACKAGE_NAME} is currently a newer version: {LATEST_VERSION}\n"
f"Please update to the latest version using the pip command:"
f"`pip install --upgrade {PACKAGE_NAME}`"
)