0

I am trying to retrieve some information on cryptocurrencies from the api offered by https://lunarcrush.com, I have the following code:

from websocket import create_connection
ws = create_connection('wss://stream.lunarcrush.com/v2')
ws.send('auth:ly4qodsfafbqq0mr04lml') # must authenticate using command: auth:<api_key>

result = ws.recv()
print(f'Received: {result}')

But this returns

Received: {"action":"auth","error":"API
 key does not provide websocket access
"}

The only familiarity I have with APIs is going to <api.somewebsite.com> and using requests to parse the data, though I imagine this is not how it is supposed to be done. I have never used the websocket package, but according to this website this how I am supposed to connect and I am using the api key they generated for me. Can anyone help with this? I am not even sure it there is a problem with the code, I see they offer a paid version but that says it is for commercial use, so I think I should be able to access the data via my free account? Thanks for any help.

1
  • 1
    Not sure if the authentication string you've included here is legitimate or just a dummy value, but in the case of the former you should seek to invalidate it as soon as possible. Commented Feb 8, 2021 at 22:45

1 Answer 1

1

The error text is pretty clear; it's indicating that the subscription associated with the key you passed isn't allowed to access the WebSocket that LunarCRUSH publishes.

As they indicate on their Pricing page, the WebSocket connection is only made available to customers subscribing to their LunarStream or Enterprise tiers of service. If you're already subscribed at one of these tiers, I'd recommend opening a support ticket with them, as Stack Overflow can't diagnose issues on a provider's end (as much as we'd like to sometimes).

I see they offer a paid version but that says it is for commercial use, so I think I should be able to access the data via my free account?

I would recommend reviewing the Pricing page I linked above -- it seems you have some misunderstanding on their subscription tiers, as it's indicated that even the Free tier is OK to use for commercial purposes.

Sign up to request clarification or add additional context in comments.

2 Comments

I have a lot to learn.... thank you for answering despite the problem not being related to code at all @esqew . Looks like I am going back to low budget web scraping.
No worries! I feel that this question is certainly within the scope of Stack Overflow, so I wouldn't worry too much about that aspect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.