Skip to content

Constant error after few hours #19

@vargaspazdaniel

Description

@vargaspazdaniel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions