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

returnBalances triggers PoloniexError: Invalid json response returned #23

Open
algonell opened this issue Mar 3, 2023 · 0 comments
Open

Comments

@algonell
Copy link

algonell commented Mar 3, 2023

<title>Poloniex - Crypto Asset Exchange</title> <style>body{margin:0;padding:0;background-color:#f7f7f7;font-family:roboto,sans-serif;font-size:14px;color:#323a3c}.main{padding:250px 10px 0;min-height:300px;text-align:center}.logo{width:191px;height:30px;margin:30px 20px 20px}.content{max-width:300px;padding:30px;background-color:#fff;margin:auto}.content h1{text-transform:capitalize;font-size:20px;margin:0;padding:0 0 10px}.content p{margin:0;line-height:18px}.content p a{color:#068485;text-decoration:none;white-space:nowrap}.content p a:hover{text-decoration:underline}.footer{font-size:14px;text-align:center;color:#818181;margin:50px 0}@media only screen and (max-width:500px){.main{padding:30px 10px}}</style>

Connection Error

Sorry, we're unable to connect to the server at the moment.

Please try again in a few minutes.

Access denied

You do not have access to poloniex.com.

The site owner may have set restrictions that prevent you from accessing the site.

  • Ray ID: 7a215e368931e3d3
  • Timestamp: 2023-03-03 10:59:05 UTC
  • Your IP address: 141.226.170.246
  • Requested URL: poloniex.com/tradingApi
  • Error reference number: 1020
  • Server ID: FL_149F22
  • User-Agent: python-requests/2.27.1
</div>
© Poloniex <script>document.write((new Date).getFullYear());</script> | Contact Support
Ray ID: 7a215e368931e3d3, IP: 141.226.170.246
<script>/** * Translate error page: * * This function assumes that the page has * "title" and "desc" DOM elements. * x-lang-override cookie is set when * the language selector is used. * * NOTE: Cloudflare collapsify dislikes ES6 * */ // eslint-disable-next-line no-unused-vars function translateErrorPage(translations) { if (!translations) { return; }

const xLanguageCookie = document.cookie.match(
/(; )?x-lang-override=([^;]*);?/
);
const xLanguage = xLanguageCookie && xLanguageCookie[2];
const title = document.getElementById("title");
const desc = document.getElementById("desc");

// eslint-disable-next-line no-prototype-builtins
if (xLanguage && translations.hasOwnProperty(xLanguage) && title && desc) {
title.innerHTML = translations[xLanguage].title;
desc.innerHTML = translations[xLanguage].desc;
}
}
</script>

<script> const translations = { "ru-ru": { "title": "Ошибка соединения", "desc": "К сожалению, в данный момент мы не можем подключиться к серверу.

Повторите попытку через несколько минут." }, "tr-tr": { "title": "Bağlantı Hatası", "desc": "Üzgünüz, şu anda sunucuya bağlanamıyoruz.

Lütfen birkaç dakika sonra tekrar deneyin." }, "vi-vn": { "title": "Lỗi kết nối", "desc": "Rất tiếc, chúng tôi không thể kết nối tới máy chủ vào lúc này.

Vui lòng thử lại sau ít phút." }, "zh-cn": { "title": "连接错误", "desc": "抱歉!目前无法连接服务器。

请在几分钟后再试一次。" } }; translateErrorPage(translations); </script> <script>for(var i=0;i --------------------------------------------------------------------------- JSONDecodeError Traceback (most recent call last) File ~/.local/lib/python3.10/site-packages/poloniex/__init__.py:268, in PoloniexBase._handleReturned(self, data) 267 if not self.jsonNums: --> 268 out = _loads(data.text, parse_float=str) 269 else:

File /usr/lib/python3.10/json/init.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
358 kw['parse_constant'] = parse_constant
--> 359 return cls(**kw).decode(s)

File /usr/lib/python3.10/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of s (a str instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()

File /usr/lib/python3.10/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

PoloniexError Traceback (most recent call last)
Cell In[9], line 1
----> 1 POLO.returnBalances()

File ~/.local/lib/python3.10/site-packages/poloniex/init.py:373, in Poloniex.returnBalances(self)
371 def returnBalances(self):
372 """ Returns all of your available balances."""
--> 373 return self.call('returnBalances')

File ~/.local/lib/python3.10/site-packages/poloniex/init.py:156, in PoloniexBase._retry..retrying(*args, **kwargs)
153 for delay in _chain(retryDelays, [None]):
154 try:
155 # attempt call
--> 156 return func(*args, **kwargs)
158 # we need to try again
159 except RequestException as problem:

File ~/.local/lib/python3.10/site-packages/poloniex/init.py:220, in PoloniexBase.call(self, command, args)
217 ret = self.session.post(**payload)
219 # return data
--> 220 return self._handleReturned(ret)
222 # public?
223 if cmdType == 'Public':
224 # encode url

File ~/.local/lib/python3.10/site-packages/poloniex/init.py:275, in PoloniexBase._handleReturned(self, data)
273 except:
274 self.logger.error(data.text)
--> 275 raise PoloniexError('Invalid json response returned')
277 # check if poloniex returned an error
278 if 'error' in out:

PoloniexError: Invalid json response returned

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

1 participant