analyseether / ether_sql

A python library to push ethereum blockchain data into an sql database.
http://ether-sql.readthedocs.io
Apache License 2.0
69 stars 22 forks source link

Infura node gives badstatus error after some blocks #7

Open ankitchiplunkar opened 6 years ago

ankitchiplunkar commented 6 years ago

If API is not provided then Infura node does not respond to HTTP request after enough requests.

This gives to Badstatus error: response = 502

[2018-05-20 09:40:50,759][DEBUG][ether_sql.scrapper] Adding block: 10557
[2018-05-20 09:40:50,860][DEBUG][requests.packages.urllib3.connectionpool] "POST / HTTP/1.1" 502 0
Traceback (most recent call last):
  File "ether_sql.py", line 9, in <module>
    cli()
  File "/home/ankit/venv/ether_sql/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ankit/venv/ether_sql/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ankit/venv/ether_sql/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ankit/venv/ether_sql/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ankit/venv/ether_sql/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ankit/projects/ether_sql/ether_sql/cli/__init__.py", line 61, in scrape_data
    node_block_number=node_block_number)
  File "/home/ankit/projects/ether_sql/ether_sql/scrapper.py", line 29, in scrape_blocks
    session=session)
  File "/home/ankit/projects/ether_sql/ether_sql/scrapper.py", line 43, in add_block_number
    block_data = node_session.eth_getBlockByNumber(block_number)
  File "/home/ankit/venv/ether_sql/src/ethjsonrpc/ethjsonrpc/client.py", line 427, in eth_getBlockByNumber
    return self._call('eth_getBlockByNumber', [block, tx_objects])
  File "/home/ankit/venv/ether_sql/src/ethjsonrpc/ethjsonrpc/client.py", line 67, in _call
    raise BadStatusCodeError(r.status_code)
ethjsonrpc.exceptions.BadStatusCodeError: 502

Possible resolutions:

  1. Provide an API key in the settings
  2. Enable error handling for such issues.