Skip to content

_private_api_query: Dictionary overwritten #1

@ligarcia7

Description

@ligarcia7

Hi,

First of all thanks for sharing this work!

I have being reviewing this code and noticed that inside "_private_api_query" the code doesn't returns the desired information when the API responds with a list of dictionaries. Specifically line 263 will overwrite the downloaded data with a blank dictionary and afterwards the status_code will be added into it returning only the status_code. I am not sure how to fix it as i can't get which was the way it was originally thought.

		data = r.json()
		print(type(data))
		if isinstance(data, list):
			status_code = r.status_code
			data = dict()
			data['status_code'] = r.status_code
		if isinstance(data, dict):
			data['status_code'] = r.status_code

		return data

The difference on the result is clear when running prv_get_balances() vs prv_get_balances('AnyCoin'):

c = bittrex_api3.prv_get_balances()
print(c)

Result:
def Bittrex.api_query(http_meth=GET, sub_path=/balances, options=null)
request_url                : https://api.bittrex.com/v3/balances
<class 'list'>
{'status_code': 200}

d = bittrex_api3.prv_get_balances('BTC')
print(d)

Result:
def Bittrex.api_query(http_meth=GET, sub_path=/balances/BTC, options=null)
request_url                : https://api.bittrex.com/v3/balances/BTC
<class 'dict'>
{'currencySymbol': 'BTC', 'total': '0.------', 'available': '0.------', 'updatedAt': '2001-01-01T00:00:00Z', 'status_code': 200}

Thanks
LG

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions