Skip to content

Commit 311b228

Browse files
committed
added coin info helper
1 parent 905c5b4 commit 311b228

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

cryptapi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cryptapi.meta import VERSION
22
from cryptapi.dispatchers import RequestDispatcher as Invoice # noqa
3-
from cryptapi.utils import get_active_providers as valid_providers, get_order_request as get_order_invoices # noqa
3+
from cryptapi.utils import get_active_providers as valid_providers, get_order_request as get_order_invoices, info as coin_info # noqa
44
from cryptapi.helpers import get_coin_multiplier, round_sig
55

66
__version__ = str(VERSION)

cryptapi/meta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from distutils.version import StrictVersion
22

33

4-
VERSION = StrictVersion('0.2.6')
4+
VERSION = StrictVersion('0.2.7')

cryptapi/utils.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def build_callback_url(_r, params):
2424

2525
def process_request(coin, endpoint='create', params=None):
2626
response = requests.get(
27-
url="{base_url}{coin}/{endpoint}".format(
27+
url="{base_url}{coin}/{endpoint}/".format(
2828
base_url=CRYPTAPI_URL,
2929
coin=coin.replace('_', '/'),
3030
endpoint=endpoint,
@@ -36,6 +36,15 @@ def process_request(coin, endpoint='create', params=None):
3636
return response
3737

3838

39+
def info(coin):
40+
_info = process_request(coin, endpoint='info')
41+
42+
if _info:
43+
return _info.json()
44+
45+
return None
46+
47+
3948
def get_active_providers():
4049

4150
from cryptapi.models import Provider

0 commit comments

Comments
 (0)