Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_private_api_query: Dictionary overwritten #1

Open
ligarcia7 opened this issue Aug 25, 2020 · 3 comments
Open

_private_api_query: Dictionary overwritten #1

ligarcia7 opened this issue Aug 25, 2020 · 3 comments

Comments

@ligarcia7
Copy link

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

@wrm3
Copy link
Owner

wrm3 commented Aug 25, 2020

That section has changed alot. I am editing my working copy to update this, very happy someone actually is looking at it! Also adding some example usages I threw together just in case it might help. trying to get my bot back online, its been 48 hours!

@ligarcia7
Copy link
Author

Thanks! I will review it and let you know if i have any issue!
This is super useful i was trying to write something myself but got frustrated as couldn't figure it out due to the huge amount of options!

@wrm3
Copy link
Owner

wrm3 commented Aug 25, 2020

yah I spent so long stuck on invalid content hash (like 3 weeks) I decided I had to share once I got something kinda working. glad it helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants