Hello. I'm trying to run blockchain api from github. https://github.com/blockchain/api-v1-client-python
My code:
from blockchain.wallet import Wallet
wallet = Wallet('identifier', 'password', 'http://127.0.0.1:3000', 'api_code')
newaddr = wallet.new_address()
When i run it i get error:
2018-07-04 08:26:09,805: Traceback (most recent call last):
2018-07-04 08:26:09,805: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1982, in wsgi_app 2018-07-04 08:26:09,805: response =
self.full_dispatch_request() 2018-07-04 08:26:09,805: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1614, in full_dispatch_request 2018-07-04 08:26:09,805: rv =
self.handle_user_exception(e) 2018-07-04 08:26:09,805: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1517, in handle_user_exception 2018-07-04 08:26:09,805:
reraise(exc_type, exc_value, tb) 2018-07-04 08:26:09,806: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/_compat.py",
line 33, in reraise 2018-07-04 08:26:09,806: raise value
2018-07-04 08:26:09,806: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1612, in full_dispatch_request 2018-07-04 08:26:09,806: rv =
self.dispatch_request() 2018-07-04 08:26:09,806: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1598, in dispatch_request 2018-07-04 08:26:09,806: return
self.view_functions[rule.endpoint](**req.view_args) 2018-07-04
08:26:09,806: File "/home/NeTR153/bot/testbot.py", line 185, in
index 2018-07-04 08:26:09,806: answer(chat_id, message)
2018-07-04 08:26:09,806: File "/home/NeTR153/bot/testbot.py", line
76, in answer 2018-07-04 08:26:09,806: newaddr =
wallet.new_address(chat_id) 2018-07-04 08:26:09,806: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/blockchain/wallet.py",
line 145, in new_address 2018-07-04 08:26:09,806: response =
util.call_api("merchant/{0}/new_address".format(self.identifier),
params, base_url=self.service_url) 2018-07-04 08:26:09,807: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/blockchain/util.py",
line 26, in call_api 2018-07-04 08:26:09,807: response =
urlopen(base_url + resource, payload, timeout=TIMEOUT).read()
2018-07-04 08:26:09,807: File
"/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
2018-07-04 08:26:09,807: return opener.open(url, data, timeout)
2018-07-04 08:26:09,807: File
"/usr/lib/python3.6/urllib/request.py", line 526, in open 2018-07-04
08:26:09,807: response = self._open(req, data) 2018-07-04
08:26:09,807: File "/usr/lib/python3.6/urllib/request.py", line 544,
in _open 2018-07-04 08:26:09,807: '_open', req) 2018-07-04
08:26:09,807: File "/usr/lib/python3.6/urllib/request.py", line 504,
in _call_chain 2018-07-04 08:26:09,807: result = func(*args)
2018-07-04 08:26:09,807: File
"/usr/lib/python3.6/urllib/request.py", line 1346, in http_open
2018-07-04 08:26:09,807: return
self.do_open(http.client.HTTPConnection, req) 2018-07-04
08:26:09,807: File "/usr/lib/python3.6/urllib/request.py", line
1286, in do_open 2018-07-04 08:26:09,808: h = http_class(host,
timeout=req.timeout, **http_conn_args) 2018-07-04 08:26:09,808:
File "/usr/lib/python3.6/http/client.py", line 849, in __init__
2018-07-04 08:26:09,808: (self.host, self.port) =
self._get_hostport(host, port) 2018-07-04 08:26:09,808: File
"/usr/lib/python3.6/http/client.py", line 890, in _get_hostport
2018-07-04 08:26:09,808: raise InvalidURL("nonnumeric port: '%s'"
% host[i+1:]) 2018-07-04 08:26:09,808: http.client.InvalidURL:
nonnumeric port: '3000merchant' 2018-07-04 08:26:14,672: [2018-07-04
08:26:14,670] ERROR in app: Exception on / [POST] 2018-07-04
08:26:14,672: Traceback (most recent call last): 2018-07-04
08:26:14,672: File "/usr/lib/python3.6/http/client.py", line 885, in
_get_hostport 2018-07-04 08:26:14,672: port = int(host[i+1:]) 2018-07-04 08:26:14,672: ValueError: invalid literal for int() with
base 10: '3000merchant' 2018-07-04 08:26:14,672: During handling of
the above exception, another exception occurred: 2018-07-04
08:26:14,673: Traceback (most recent call last): 2018-07-04
08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1982, in wsgi_app 2018-07-04 08:26:14,673: response =
self.full_dispatch_request() 2018-07-04 08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1614, in full_dispatch_request 2018-07-04 08:26:14,673: rv =
self.handle_user_exception(e) 2018-07-04 08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1517, in handle_user_exception 2018-07-04 08:26:14,673:
reraise(exc_type, exc_value, tb) 2018-07-04 08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/_compat.py",
line 33, in reraise 2018-07-04 08:26:14,673: raise value
2018-07-04 08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1612, in full_dispatch_request 2018-07-04 08:26:14,673: rv =
self.dispatch_request() 2018-07-04 08:26:14,673: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/flask/app.py", line
1598, in dispatch_request 2018-07-04 08:26:14,674: return
self.view_functions[rule.endpoint](**req.view_args) 2018-07-04
08:26:14,674: File "/home/NeTR153/bot/testbot.py", line 185, in
index 2018-07-04 08:26:14,674: answer(chat_id, message)
2018-07-04 08:26:14,674: File "/home/NeTR153/bot/testbot.py", line
76, in answer 2018-07-04 08:26:14,674: newaddr =
wallet.new_address(chat_id) 2018-07-04 08:26:14,674: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/blockchain/wallet.py",
line 145, in new_address 2018-07-04 08:26:14,674: response =
util.call_api("merchant/{0}/new_address".format(self.identifier),
params, base_url=self.service_url) 2018-07-04 08:26:14,674: File
"/home/NeTR153/venv2/lib/python3.6/site-packages/blockchain/util.py",
line 26, in call_api 2018-07-04 08:26:14,674: response =
urlopen(base_url + resource, payload, timeout=TIMEOUT).read()
2018-07-04 08:26:14,674: File
"/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
2018-07-04 08:26:14,674: return opener.open(url, data, timeout)
2018-07-04 08:26:14,674: File
"/usr/lib/python3.6/urllib/request.py", line 526, in open 2018-07-04
08:26:14,675: response = self._open(req, data) 2018-07-04
08:26:14,675: File "/usr/lib/python3.6/urllib/request.py", line 544,
in _open 2018-07-04 08:26:14,675: '_open', req) 2018-07-04
08:26:14,675: File "/usr/lib/python3.6/urllib/request.py", line 504,
in _call_chain 2018-07-04 08:26:14,675: result = func(*args)
2018-07-04 08:26:14,675: File
"/usr/lib/python3.6/urllib/request.py", line 1346, in http_open
2018-07-04 08:26:14,675: return
self.do_open(http.client.HTTPConnection, req) 2018-07-04
08:26:14,675: File "/usr/lib/python3.6/urllib/request.py", line
1286, in do_open 2018-07-04 08:26:14,675: h = http_class(host,
timeout=req.timeout, **http_conn_args) 2018-07-04 08:26:14,675:
File "/usr/lib/python3.6/http/client.py", line 849, in __init__
2018-07-04 08:26:14,675: (self.host, self.port) =
self._get_hostport(host, port) 2018-07-04 08:26:14,675: File
"/usr/lib/python3.6/http/client.py", line 890, in _get_hostport
2018-07-04 08:26:14,675: raise InvalidURL("nonnumeric port: '%s'"
% host[i+1:]) 2018-07-04 08:26:14,676: http.client.InvalidURL:
nonnumeric port: '3000merchant'
I think this error is because port 3000 is not open.
I tried to blockchain-wallet-service start --port 80 and blockchain-wallet-service start --port 443
but got errors:
1530693477439 - error: listen EACCES 127.0.0.1:443
1530693477439 - error: listen EACCES 127.0.0.1:80
I really need someone's help. It is very important for me.
[edit by admin: formatting]