pcko1 / etherscan-python

A minimal, yet complete, python API for Etherscan.io.
MIT License
408 stars 111 forks source link

Constant error after few hours #19

Closed vargaspazdaniel closed 3 years ago

vargaspazdaniel commented 3 years ago

Hello,

I'm using this package to retrieve the eth gas price every 30 seconds and save it in a HDF5 file, but at a random time after a random times I'm getting an error related to the parsing function in the package:

File "/root/miniconda3/lib/python3.8/site-packages/etherscan/utils/parsing.py", line 12, in parse
    assert status, f"{result} -- {message}"
AssertionError: Error! -- NOTOK

This is my complete code:

import time
import h5py
import pandas as pd
from datetime import datetime
from etherscan import Etherscan

# my api from etherscan.io
eth = Etherscan("MY_API")

# Creating the HDF5 database
store = pd.HDFStore("eth_gas.h5")
while True:
    try:
        gas_db = pd.DataFrame() 
        gas = eth.get_gas_oracle()

        for key in gas:
            gas[key] = int(gas[key]) 

        gas_db = pd.DataFrame(gas, index = [pd.to_datetime(datetime.now(), format="%Y-%m-%d %H:%M:%S.%f")])

        store.append("eth_gas", gas_db, format='table',  encoding = "UTF8", data_columns=True) 
        print("######### Last time read (30 seconds) #########\n", gas_db.iloc[-1], "\n") 
        time.sleep(30)
    except ValueError:
        print("Something was wrong... Trying again...")

And as I said, everything is running smoothly and without problems and randomly I got that error, my script dies and I can not build a consistent data base of historical price gas.

github-actions[bot] commented 3 years ago

Thanks for reporting this issue, we are on it :)

pcko1 commented 3 years ago

This is probably some temporary Etherscan misbehaviour AFAIK. Nothing to be done on our end :(

vargaspazdaniel commented 3 years ago

Any way to deal with this? I mean, if I have this error, try again the petition.

El mié, 16 jun 2021 a las 23:13, Pan Kotsias @.***>) escribió:

This is probably some temporary Etherscan misbehaviour AFAIK. Nothing to be done on our end :(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pcko1/etherscan-python/issues/19#issuecomment-862730913, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ4IFARWZXS727KSULOWEE3TTEHZDANCNFSM46OL4LFQ .