Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Get Table function giving error #31

Closed
ShilazTech opened this issue Feb 1, 2019 · 2 comments
Closed

Get Table function giving error #31

ShilazTech opened this issue Feb 1, 2019 · 2 comments

Comments

@ShilazTech
Copy link

I am trying to get table information with below code
cd=ce.get_code("betdiceadmin")
rollahead=ce.get_table(code=cd["code_hash"],scope="betdiceadmin",table="bet",lower_bound=0,limit=5,timeout=30)

but It gives below error
Traceback (most recent call last):
File "C:\Users\R.K Tyagi\PycharmProjects\MagicDice\venv\lib\site-packages\eospy\dynamic_url.py", line 41, in post_url
r.raise_for_status()
File "C:\Users\R.K Tyagi\PycharmProjects\MagicDice\venv\lib\site-packages\requests\models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://eos.greymass.com:443/v1/chain/get_table_rows

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/R.K Tyagi/Documents/VulturesPick/EOS/EOSbetdiceadminPredictorandTrader.py", line 58, in
rollahead=ce.get_table(code=cd["wasm"],scope="betdiceadmin",table="bet",lower_bound=0,limit=5,timeout=30)
File "C:\Users\R.K Tyagi\PycharmProjects\MagicDice\venv\lib\site-packages\eospy\cleos.py", line 132, in get_table
return self.post('chain.get_table_rows', params=None, json=json, timeout=timeout)
File "C:\Users\R.K Tyagi\PycharmProjects\MagicDice\venv\lib\site-packages\eospy\cleos.py", line 33, in post
return cmd.post_url(url, **kwargs)
File "C:\Users\R.K Tyagi\PycharmProjects\MagicDice\venv\lib\site-packages\eospy\dynamic_url.py", line 43, in post_url
raise requests.exceptions.HTTPError('Error: {}'.format(r.json()))
requests.exceptions.HTTPError: Error: {'code': 500, 'message': 'Internal Service Error', 'error': {'code': 3010001, 'name': 'name_type_exception', 'what': 'Invalid name', 'details': [{'message': 'Name is longer than 13 characters

Process finished with exit code 1

How to solve this?

@deckb
Copy link
Member

deckb commented Feb 1, 2019

I see the issue and it is that I need to document better. You do not pass the actual code of the contract to the get_table function. The code parameter is the account of the code you are querying. I used the name code to be consistent with the eosio code but it isn't very descriptive.

Your code should look like this:

# cd=ce.get_code("betdiceadmin")
rollahead=ce.get_table(code='betdiceadmin',scope="betdiceadmin",table="bet",lower_bound=0,limit=5,timeout=30)

@ShilazTech
Copy link
Author

Thank you. Yes -It works.

@deckb deckb closed this as completed Feb 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants