jacksmithinsulander / rsab

Other
4 stars 0 forks source link

Intermittent error during scanning - json.decoder.JSONDecodeError (...) #125

Open larsyngvelundin opened 10 months ago

larsyngvelundin commented 10 months ago

Intermittently when trying to get the symbol from ERC20 contracts, we get these errors:

Traceback (most recent call last):
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\_utils\encoding.py", line 226, in json_decode
    decoded = json.loads(json_str)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\nok13\Documents\GitHub\WAGMI\main.py", line 100, in <module>
    start_scanner()
  File "C:\Users\nok13\Documents\GitHub\WAGMI\main.py", line 37, in start_scanner
    scanner.start()
  File "C:\Users\nok13\Documents\GitHub\WAGMI\modules\scanner\scanner_main.py", line 75, in start
    token2_symbol = token2.functions.symbol().call()
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3_balancer\main.py", line 96, in __call__
    return self._call_w3_func(func_call)
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3_balancer\main.py", line 100, in _call_w3_func
    self._w3 = self.get_w3(self.net)
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3_balancer\main.py", line 56, in get_w3
    return self.get_w3(network)
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3_balancer\main.py", line 47, in get_w3
    if (self.is_contract.w3.is_connected()):
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\main.py", line 445, in is_connected
    return self.provider.is_connected()
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\providers\base.py", line 110, in is_connected
    response = self.make_request(RPCEndpoint("web3_clientVersion"), [])
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\providers\rpc.py", line 93, in make_request
    response = self.decode_rpc_response(raw_response)
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\providers\base.py", line 96, in decode_rpc_response
    return cast(RPCResponse, FriendlyJsonSerde().json_decode(text_response))
  File "C:\Users\nok13\Documents\GitHub\WAGMI\venv\lib\site-packages\web3\_utils\encoding.py", line 232, in json_decode
    raise json.decoder.JSONDecodeError(err_msg, exc.doc, exc.pos)
json.decoder.JSONDecodeError: Could not decode '<!doctype html>\n<html data-adblockkey="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANDrp2lz7AOmADaN8tA50LsWcjLFyQFcb/P2Txc58oYOeILb3vBw7J6f4pamkAQVSQuqYsKx3YzdUHCvbVZvFUsCAwEAAQ==_VgFwaC3qkh+DE2wImu1/lytWPYNOB31eyXnb+uIZRKRYVlBnImTzuGyM1epbMiBpu6GzoiTZH/BDSh0OrD9aUQ==" lang="en">\n<head>\n    <meta charset="utf-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1">\n    <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC">\n    <link rel="preconnect" href="https://www.google.com" crossorigin>\n</head>\n<body>\n<div id="target" style="opacity: 0"></div>\n<script>window.park = "eyJ1dWlkIjoiOTMwMWM3Y2UtY2UwMy00NGY0LTg5MjgtNDIwZDY5MzM1NTc3IiwicGFnZV90aW1lIjoxNzAwMDgwNDA2LCJwYWdlX3VybCI6Imh0dHBzOi8vbm9kZXMudmVmaW5ldHdvcmsub3JnL3NtYXJ0Y2hhaW4iLCJwYWdlX21ldGhvZCI6IlBPU1QiLCJwYWdlX3JlcXVlc3QiOnt9LCJwYWdlX2hlYWRlcnMiOnt9LCJob3N0Ijoibm9kZXMudmVmaW5ldHdvcmsub3JnIiwiaXAiOiIxODUuNTYuODMuODMifQo=";</script>\n<script src="/brzrCPdBN.js"></script>\n</body>\n</html>\n' because of Expecting value: line 1 column 1 (char 0).: line 1 column 1 (char 0)

Function where it originates in our code seems to be token2.functions.symbol().call(), line 75, in scanner_main.py