question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upbit private API methods don't work.

See original GitHub issue
  • OS: Ubuntu 16.04.6
  • Programming Language version: Python 3.7.3
  • CCXT version: 1.28.721 ~ current version
  • Exchange: Upbit
  • Method: Private API’s

Hello, Private API methods for Upbit haven’t been working since 1.28.721. I currently can’t help but use 1.28.720(which works fine). It’d be great if you would fix it.

The error message is as follows.

In [6]: upbit.fetchBalance()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-1671966e7b10> in <module>
----> 1 upbit.fetchBalance()

~/py3/lib/python3.7/site-packages/ccxt/upbit.py in fetch_balance(self, params)
    403     def fetch_balance(self, params={}):
    404         self.load_markets()
--> 405         response = self.privateGetAccounts(params)
    406         #
    407         #     [{         currency: "BTC",

~/py3/lib/python3.7/site-packages/ccxt/base/exchange.py in inner(_self, params)
    419                             if params is not None:
    420                                 inner_kwargs['params'] = params
--> 421                             return entry(_self, **inner_kwargs)
    422                         return inner
    423                     to_bind = partialer()

~/py3/lib/python3.7/site-packages/ccxt/base/exchange.py in request(self, path, api, method, params, headers, body)
    448     def request(self, path, api='public', method='GET', params={}, headers=None, body=None):
    449         """Exchange.request is the entry point for all generated methods"""
--> 450         return self.fetch2(path, api, method, params, headers, body)
    451
    452     @staticmethod

~/py3/lib/python3.7/site-packages/ccxt/base/exchange.py in fetch2(self, path, api, method, params, headers, body)
    443             self.throttle()
    444         self.lastRestRequestTimestamp = self.milliseconds()
--> 445         request = self.sign(path, api, method, params, headers, body)
    446         return self.fetch(request['url'], request['method'], request['headers'], request['body'])
    447
~/py3/lib/python3.7/site-packages/ccxt/upbit.py in sign(self, path, api, method, params, headers, body)
   1408             if query:
   1409                 request['query'] = self.urlencode(query)
-> 1410             jwt = self.jwt(request, self.secret)
   1411             headers = {
   1412                 'Authorization': 'Bearer ' + jwt,

~/py3/lib/python3.7/site-packages/ccxt/base/exchange.py in jwt(request, secret, alg)
    982         else:
    983             algorithm = algos[alg]
--> 984             signature = Exchange.hmac(token, secret, algorithm, 'binary')
    985         return token + '.' + Exchange.base64urlencode(signature)
    986

~/py3/lib/python3.7/site-packages/ccxt/base/exchange.py in hmac(request, secret, algorithm, digest)
    942     @staticmethod
    943     def hmac(request, secret, algorithm=hashlib.sha256, digest='hex'):
--> 944         h = hmac.new(secret, request, algorithm)
    945         if digest == 'hex':
    946             return h.hexdigest()

~/py3/lib/python3.7/hmac.py in new(key, msg, digestmod)
    151     method.
    152     """
--> 153     return HMAC(key, msg, digestmod)
    154
    155

~/py3/lib/python3.7/hmac.py in __init__(self, key, msg, digestmod)
     47
     48         if not isinstance(key, (bytes, bytearray)):
---> 49             raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
     50
     51         if digestmod is None:

TypeError: key: expected bytes or bytearray, but got 'str'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jjh2811commented, Jun 22, 2019

@kroitor Yay, it fixed. Thank you for your quick response and help.

1reaction
kroitorcommented, Jun 22, 2019

@jjh2811 ok, i’ve added one more fix, can you please test it and report after upgrading to version 1.18.781 (need to wait 10-15 minutes again)? I’ve reproduced this case on my side and fixed it, so it works with my Python 3.7.2. We will be happy if you report back whether it resolved the issue for you or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

upbit API - Bitcoin Forum
Hello, does anybody know the URL for Ticker for upbit exchange? ... Cannot find anything there and it seems they don't have english...
Read more >
Upbit API | ProgrammableWeb
The Upbit API allows users to programmatically look up their assets, place orders, make deposits and withdrawals, and get quotes. Upbit is a...
Read more >
upbit-api-node - npm
Install. $ npm i -S upbit-api-node. Disclaimer. I am not responsible for anything done with this. You use it at your own risk....
Read more >
FAQ - Upbit - The Most Trusted Digital Asset Exchange
Support. Notices; User Guide; Open API; Wallet Status; FAQ; Submit Request; My Requests ... Not Receive Verification Email. If you do not receive...
Read more >
Resolve connection issues with API Gateway private ... - AWS
If API requests are reaching the endpoint, then an error message similar to one of the following examples appears: "User: anonymous is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found