Merge pull request #31 from floscha/schemeless-url
Accept URLs without scheme (also includes #18 and #28)
This commit is contained in:
commit
250a01c83e
|
@ -25,7 +25,14 @@ class Blockchain:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
parsed_url = urlparse(address)
|
parsed_url = urlparse(address)
|
||||||
self.nodes.add(parsed_url.netloc)
|
if parsed_url.netloc:
|
||||||
|
self.nodes.add(parsed_url.netloc)
|
||||||
|
elif parsed_url.path:
|
||||||
|
# Accepts an URL without scheme like '192.168.0.5:5000'.
|
||||||
|
self.nodes.add(parsed_url.path)
|
||||||
|
else:
|
||||||
|
raise ValueError('Invalid URL')
|
||||||
|
|
||||||
|
|
||||||
def valid_chain(self, chain):
|
def valid_chain(self, chain):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue