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.

Authorization fails for LakeBTC when calling private API

See original GitHub issue

When trying to call fetch_balance() for with lakeBTC I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/lakebtc.py", line 72, in fetch_balance
    response = self.privatePostGetAccountInfo()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/lakebtc.py", line 199, in request
    response = self.fetch2(path, api, method, params, headers, body)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py", line 258, in fetch2
    request = self.sign(path, api, method, params, headers, body)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/lakebtc.py", line 193, in sign
    'Authorization': "Basic " + self.apiKey + ':' + signature,
TypeError: must be str, not bytes

https://github.com/ccxt/ccxt/blob/4535a1d7fbae1a55c036bacba799cdcdc4deb51f/python/ccxt/lakebtc.py#L193

I think this is because both self.apiKey and signature are bytes and you are trying to concatenate them into a string. I think they need to be converted into strings. I think also, you need to create the string self.apiKey + ':' + signature and convert that into base64 before adding it 'Basic '.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Jan 31, 2018

@LaurentIsRunning this is fixed in the most recent version of ccxt as well, thx for reporting! Let us know if you have any other difficulties with it.

1reaction
kroitorcommented, Nov 12, 2017

Ok, this is now fixed completely, let us know if you have any difficulties with it. Thx again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve connection issues with API Gateway private ... - AWS
AWS resources in Amazon VPC can fail to connect to a private API ... "User: anonymous is not authorized to perform: execute-api:Invoke on ......
Read more >
ccxt Documentation - Read the Docs
The ccxt library currently supports the following 115 cryptocurrency exchange markets and trading APIs: id name ver doc countries. _1broker.
Read more >
How do I troubleshoot issues connecting to an API Gateway ...
How do I troubleshoot issues connecting to an API Gateway private API endpoint? 4.5K views 11 months ago. Amazon Web Services.
Read more >
CCXT-REST API Documentation
createPrivateConnection. Creates a private connection to the exchange referenced in {exchangeName}. Authorizations: bearerAuth ...
Read more >
teatien-ccxt - CryptoCurrency eXchange Trading Library - PyPI
id name ver doc acx ACX 2 API anxpro ANXPro * API aofex AOFEX * API
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