Skip to content

Commit 4476275

Browse files
committed
Add condition to check for secret key and return correct uri
1 parent c3be0f9 commit 4476275

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

.circleci/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ jobs:
181181
TOXENV: py36-ethpm
182182
# Please don't use this key for any shenanigans
183183
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22
184-
WEB3_INFURA_API_SECRET: 1955838f22ac4d858434f41498557130
185184

186185
py36-integration-goethereum-ipc-1.7.2:
187186
<<: *geth_steps
@@ -290,7 +289,6 @@ jobs:
290289
TOXENV: py37-ethpm
291290
# Please don't use this key for any shenanigans
292291
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22
293-
WEB3_INFURA_API_SECRET: 1955838f22ac4d858434f41498557130
294292

295293
py37-integration-goethereum-ipc-1.7.2:
296294
<<: *geth_steps
@@ -399,7 +397,6 @@ jobs:
399397
TOXENV: py38-ethpm
400398
# Please don't use this key for any shenanigans
401399
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22
402-
WEB3_INFURA_API_SECRET: 1955838f22ac4d858434f41498557130
403400

404401
py38-integration-goethereum-ipc-1.7.2:
405402
<<: *geth_steps

newsfragments/1501.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Infura websocket provider works when no secret key is present

tests/core/providers/test_auto_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_web3_auto_infura_websocket_default(monkeypatch, caplog, environ_name):
107107
monkeypatch.setenv('WEB3_INFURA_SCHEME', 'wss')
108108
API_KEY = 'aoeuhtns'
109109
monkeypatch.setenv(environ_name, API_KEY)
110-
expected_url = 'wss://:@%s/ws/v3/%s' % (infura.INFURA_MAINNET_DOMAIN, API_KEY)
110+
expected_url = 'wss://%s/ws/v3/%s' % (infura.INFURA_MAINNET_DOMAIN, API_KEY)
111111

112112
importlib.reload(infura)
113113
assert len(caplog.record_tuples) == 0

web3/auto/infura/endpoints.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ def build_infura_url(domain):
4646
key = load_api_key()
4747
secret = load_secret()
4848

49-
if scheme == WEBSOCKET_SCHEME:
49+
if scheme == WEBSOCKET_SCHEME and secret != '':
5050
return "%s://:%s@%s/ws/v3/%s" % (scheme, secret, domain, key)
51+
elif scheme == WEBSOCKET_SCHEME and secret == '':
52+
return "%s://%s/ws/v3/%s" % (scheme, domain, key)
5153
elif scheme == HTTP_SCHEME:
5254
return "%s://%s/v3/%s" % (scheme, domain, key)
5355
else:

0 commit comments

Comments
 (0)