Skip to content

Commit

Permalink
Update Version 1.1.6.12
Browse files Browse the repository at this point in the history
Update Version 1.1.6.12
  • Loading branch information
uJhin authored Jan 10, 2021
1 parent 8544d46 commit 07a0121
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 52 deletions.
21 changes: 21 additions & 0 deletions client/python/upbit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import logging

from upbit import pkg_version

__all__ = ['client']
__module_name__ = 'upbit-client'

__version__ = '1.1.6.12'
__released_version__ = pkg_version.get_versions(__module_name__)
__latest_version__ = __released_version__[0]


if __latest_version__ != __version__:
logging.basicConfig(format="[%(levelname)s] %(message)s")
logging.warning(
f"{__module_name__} is currently a newer version: "
f"{__latest_version__}\n"
f"Please update to the latest version using the pip command: "
f"`pip install --upgrade {__module_name__}`"
)
1 change: 1 addition & 0 deletions client/python/upbit/authentication.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import jwt
import hashlib
import uuid
Expand Down
104 changes: 52 additions & 52 deletions client/python/upbit/client.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@

from bravado.requests_client import RequestsClient as rc
from bravado.client import SwaggerClient as sc
from upbit.authentication import APIKeyAuthenticator


HOST = "https://api.upbit.com"
SPEC_URI = "https://raw.githubusercontent.com/uJhin/upbit-client/main/mapper/swg_mapper.json"


def Upbit(access_key: str = None, secret_key: str = None, **kwargs) -> sc:
"""
Upbit Client
Please read the official Upbit Client document.
Documents: https://ujhin.github.io/upbit-client-docs/
- Base URL: https://api.upbit.com
- Base Path: /v1
- Upbit OPEN API Version: 1.1.6
- Author: ujhin
- Email: [email protected]
- GitHub: https://github.com/uJhin
- Official OPEN API Documents: https://docs.upbit.com
- Official Support Email: [email protected]
"""

arg_config = kwargs.get('config')
arg_spec_uri = kwargs.get('spec_uri')
config = {
'also_return_response': False,
'validate_responses': False,
'use_models': False,
'host': HOST
} if not arg_config else arg_config
spec_uri = SPEC_URI if not arg_spec_uri else arg_spec_uri

if access_key and secret_key:

request_client = rc()
request_client.authenticator = APIKeyAuthenticator(
config['host'], access_key, secret_key)

client = sc.from_url(
spec_url=spec_uri, http_client=request_client, config=config)

else:

client = sc.from_url(spec_url=spec_uri, config=config)

client.__class__.__name__ = 'UpbitClient'
return client


from bravado.requests_client import RequestsClient as rc
from bravado.client import SwaggerClient as sc
from upbit.authentication import APIKeyAuthenticator


HOST = "https://api.upbit.com"
SPEC_URI = "https://raw.githubusercontent.com/uJhin/upbit-client/main/mapper/swg_mapper.json"


def Upbit(access_key: str = None, secret_key: str = None, **kwargs) -> sc:
"""
Upbit Client
Please read the official Upbit Client document.
Documents: https://ujhin.github.io/upbit-client-docs/
- Base URL: https://api.upbit.com
- Base Path: /v1
- Upbit OPEN API Version: 1.1.6
- Author: ujhin
- Email: [email protected]
- GitHub: https://github.com/uJhin
- Official OPEN API Documents: https://docs.upbit.com
- Official Support Email: [email protected]
"""

arg_config = kwargs.get('config')
arg_spec_uri = kwargs.get('spec_uri')
config = {
'also_return_response': False,
'validate_responses': False,
'use_models': False,
'host': HOST
} if not arg_config else arg_config
spec_uri = SPEC_URI if not arg_spec_uri else arg_spec_uri

if access_key and secret_key:

request_client = rc()
request_client.authenticator = APIKeyAuthenticator(
config['host'], access_key, secret_key)

client = sc.from_url(
spec_url=spec_uri, http_client=request_client, config=config)

else:

client = sc.from_url(spec_url=spec_uri, config=config)

client.__class__.__name__ = 'UpbitClient'
return client
12 changes: 12 additions & 0 deletions client/python/upbit/pkg_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

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)

0 comments on commit 07a0121

Please sign in to comment.