chmod77 / dfuse-python

Python bindings for https://dfuse.io
MIT License
9 stars 1 forks source link

Unable to chain account names on `get_table_accounts` #1

Closed chmod77 closed 4 years ago

chmod77 commented 4 years ago

The get_table_accounts call (for GET /v0/state/tables/scopes) is not working, due to request's parsing of pipes (I) to a URL-encoded scheme.

Chaining multiple accounts on the request is not possible as of now, i.e "https://mainnet.eos.dfuse.io/v0/state/tables/scopes?account=eosio&scopes=eosio.token|eosadddddddd|tokenbyeocat|ethsidechain|epraofficial|alibabapoole|hirevibeshvt|oo1122334455|irespotokens|publytoken11|parslseed123|trybenetwork|zkstokensr4u&table=delband&block_num=25000000&json=true" is not possible to achieve on this wrapper.

Calling get_table_accounts(accounts='eosio.token|eosadddddddd|tokenbyeocat|ethsidechain|epraofficial|alibabapoole|hirevibeshvt|oo1122334455|irespotokens|publytoken11|parslseed123|trybenetwork|zkstokensr4u', scope='b1', table='accounts', block_num=25000000) fails, and results in a bad request because the request is parsed as

https://mainnet.eos.dfuse.io/v0/state/table?accounts=eosio.token%7Ceosadddddddd%7Ctokenbyeocat%7Cethsidechain%7Cepraofficial%7Calibabapoole%7Chirevibeshvt%7Coo1122334455%7Cirespotokens%7Cpublytoken11%7Cparslseed123%7Ctrybenetwork%7Czkstokensr4u&scope=b1&table=accounts&block_num=25000000&json=true

maoueh commented 4 years ago

The POST method is now supported on /state/table/scopes and /state/table/accounts so it's possible to avoid your problem by using POST and Content-Type: application/x-www-form-urlencoded.

POST https://mainnet.eos.dfuse.io/v0/state/tables/scopes
Authorization: Bearer DFUSE_API_TOKEN
Content-Type: application/x-www-form-urlencoded

accounts=eosio.token|eosadddddddd|tokenbyeocat&scope=b1&table=accounts
chmod77 commented 4 years ago

Thanks @maoueh ! Changing the request to POST shortly.

maoueh commented 4 years ago

curl -X POST -H "Authorization: Bearer $DFUSE_API_TOKEN" -H 'Content-Type: application/x-www-form-urlencoded' -d 'scopes=eosio.token|eosadddddddd|tokenbyeocat&account=eosio.token&table=accounts' https://mainnet.eos.dfuse.io/v0/state/tables/scopes

chmod77 commented 4 years ago

This has been fixed for /state/tables/scopes, and leverages POST.