Repository navigation
Not able to execute any function. Node used: http://eos.greymass.com (Error: Only Absolute URLs are supported) (Traceback Attached) #3
Description
Activity
it seems you have an error on the url of your nodeos, you only need to provide your base url
https://eos.greymass.com.
this is an example:eos = Eos({ 'http_address': 'http://localhost:8888', 'key_provider': 'your secret key here' }) eos.get_currency_balance('eosio.token', 'ACCOUNTNAME', 'SYMBOL')I first tried base url (https://eos.greymass.com) but that was also not working. Traceback below:
GetBalanceException Traceback (most recent call last)
in ()
1 #eos.get_currency_balance()
2 eos = Eos({'http_address': 'http://eos.greymass.com'})
----> 3 eos.get_currency_balance('eosio.token', 'eoscanadacom', 'EOS')~\Anaconda3\lib\site-packages\eosjs_python_init_.py in get_currency_balance(self, code, account, symbol)
98 return json_value_ans
99 else:
--> 100 raise GetBalanceException(response.stderr)
101
102GetBalanceException: b'api < error \t 'http://eos.greymass.com\'/v1/chain/get_info {}\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getInfo (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at checkChainId (C:\Users\admin\node_modules\eosjs\lib\index.js:431:11)\n at createEos (C:\Users\admin\node_modules\eosjs\lib\index.js:85:5)\n at Eos (C:\Users\admin\node_modules\eosjs\lib\index.js:42:10)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:10:7)\napi < error \t 'http://eos.greymass.com\'/v1/chain/get_currency_balance {"code":"'eosio.token'","account":"'eoscanadacom'","symbol":"'EOS'","json":true}\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getCurrencyBalance (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:15:5)\n at Module._compile (module.js:643:30)\n at Object.Module._extensions..js (module.js:654:10)\n at Module.load (module.js:556:32)\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getInfo (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at checkChainId (C:\Users\admin\node_modules\eosjs\lib\index.js:431:11)\n at createEos (C:\Users\admin\node_modules\eosjs\lib\index.js:85:5)\n at Eos (C:\Users\admin\node_modules\eosjs\lib\index.js:42:10)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:10:7)\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getCurrencyBalance (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:15:5)\n at Module._compile (module.js:643:30)\n at Object.Module._extensions..js (module.js:654:10)\n at Module.load (module.js:556:32)
can you share your code snippet? I don't understand why your nodeosd link is broken ?
Below is the code snippet:
from eosjs_python import Eos
eos = Eos({'http_address': 'http://eos.greymass.com'})
eos.get_currency_balance('eosio.token', 'eoscanadacom', 'EOS')you need to add you the private key when you initiate your Eos class . like this
eos = Eos({ 'http_address': 'http://localhost:8888', 'key_provider': '973rhkldfnwdfeyt3ugddjkbfdkjfdif' })``` also, make sure to update eosjs_python version to latest one (0.1.61)Thank you very much for the quick replies. However, I added my private key everytime. Just that I didn't disclose it. Maybe I should have pasted the below code snippet:
from eosjs_python import Eos
eos = Eos({'http_address': 'http://eos.greymass.com','key_provider': 'private key'})
eos.get_currency_balance('eosio.token', 'eoscanadacom', 'EOS')Also, I upgraded the eosjs_python to 0.1.61 after you corrected the json parsing error some 10 hours back. But the exact same error is showing up. I guess it's because somewhere in the code, its adding \ to the node URL. Also its adding "/n", "/t" everywhere. Thanks
very wired issue, can you run nodejs script directly :
go to js folder and then run this node GetCurrencyBalance.js 'http://127.0.0.1:8888' 'privatekey' 'eosio.token' 'accountName' 'symbol'note: the arguments need to follow the same order provided in the exemple .
I've run a test on my end, it works without the private key:

I just tried running nodejs script directly and finally it ran with some minor changes (URL without quotes and double quotes everywhere instead of single) in your script:
node GetCurrencyBalance.js http://eos.greymass.com "" "eosio.token" "eoscanadacom" "EOS"
But could you please help me with the python script?Same problem here...does anyone know where is a problem?
GetBalanceException Traceback (most recent call last)
in ()
1 #eos.get_currency_balance()
----> 2 eos.get_currency_balance('eosio.token', 'eoscanadacom', 'EOS')
~\Anaconda3\lib\site-packages\eosjs_python_init_.py in get_currency_balance(self, code, account, symbol)
98 return json_value_ans
99 else:
--> 100 raise GetBalanceException(response.stderr)
101
102
GetBalanceException: b'api < error \t 'https://eos.greymass.com:443\'/v1/chain/get_info {}\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getInfo (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at checkChainId (C:\Users\admin\node_modules\eosjs\lib\index.js:431:11)\n at createEos (C:\Users\admin\node_modules\eosjs\lib\index.js:85:5)\n at Eos (C:\Users\admin\node_modules\eosjs\lib\index.js:42:10)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:10:7)\napi < error \t 'https://eos.greymass.com:443\'/v1/chain/get_currency_balance {"code":"'eosio.token'","account":"'eoscanadacom'","symbol":"'EOS'","json":true}\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getCurrencyBalance (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:15:5)\n at Module._compile (module.js:643:30)\n at Object.Module._extensions..js (module.js:654:10)\n at Module.load (module.js:556:32)\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getInfo (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at checkChainId (C:\Users\admin\node_modules\eosjs\lib\index.js:431:11)\n at createEos (C:\Users\admin\node_modules\eosjs\lib\index.js:85:5)\n at Eos (C:\Users\admin\node_modules\eosjs\lib\index.js:42:10)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:10:7)\nError: only absolute urls are supported\n at C:\Users\admin\node_modules\node-fetch\index.js:54:10\n at new Promise ()\n at new Fetch (C:\Users\admin\node_modules\node-fetch\index.js:49:9)\n at Fetch (C:\Users\admin\node_modules\node-fetch\index.js:37:10)\n at module.exports (C:\Users\admin\node_modules\isomorphic-fetch\fetch-npm-node.js:8:19)\n at Object.getCurrencyBalance (C:\Users\admin\node_modules\eosjs-api\lib\apigen.js:90:5)\n at Object. (C:\Users\admin\Anaconda3\lib\site-packages\eosjs_python\js\GetCurrencyBalance.js:15:5)\n at Module._compile (module.js:643:30)\n at Object.Module._extensions..js (module.js:654:10)\n at Module.load (module.js:556:32)\n