LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
685 stars 165 forks source link

Fixed error "Error: 2 - string indices must be integers", issue #98 #106

Closed Flowelfox closed 4 years ago

Flowelfox commented 4 years ago

Description

I forgot brackets in previous commit Added additional check for dict when searching for errors.

Related Issue

98

Motivation and Context

This pull request fixes critical error in library because kline stream constantly restarting

How Has This Been Tested

Tested localy

Types of changes

Checklist

oliver-zehentleitner commented 4 years ago

I think thats great to handle the problem :D

I will merge this weekend and prepare a new release!

Thank you!

oliver-zehentleitner commented 4 years ago

I would like to suggest a change: Please do:

           if isinstance(uri, dict):
                if uri['code'] == -2014 or uri['code'] == -2015 or uri['code'] == -2008:
                     # -2014 = API-key format invalid

I think that way its easy to read for someone who doesnt know the code. Its more intuitive to understand. Which can avoid coding mistakes in the future. Thanks

kimchirichie commented 4 years ago

yayy