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

Not able to execute any function. Node used: http://eos.greymass.com (Error: Only Absolute URLs are supported) (Traceback Attached) #3

Open
outlier89 opened this issue Aug 31, 2018 · 9 comments

Comments

@outlier89
Copy link

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

@MerouaneBen
Copy link
Contributor

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')

@outlier89
Copy link
Author

outlier89 commented Sep 1, 2018

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
102

GetBalanceException: 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)

@MerouaneBen
Copy link
Contributor

can you share your code snippet? I don't understand why your nodeosd link is broken ?

@outlier89
Copy link
Author

outlier89 commented Sep 4, 2018

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')

@MerouaneBen
Copy link
Contributor

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)

@outlier89
Copy link
Author

outlier89 commented Sep 4, 2018

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

@MerouaneBen
Copy link
Contributor

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:
scre

@outlier89
Copy link
Author

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"
capture
But could you please help me with the python script?

@nejc-skerjanc
Copy link

Same problem here...does anyone know where is a problem?

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

3 participants