def __init__(
        self,
        start=True,
        rpc_port=8545,
        host="http://localhost",
        delay=0.0001
    ):
        """Initialize the Crawler."""
        logging.debug("Starting Crawler")
        self.url = "{}:{}".format(host, rpc_port)
        self.headers = {"content-type": "application/json"}

        # Initializes to default host/port = localhost/27017
        self.mongo_client = crawler_util.initMongo(MongoClient())
        # The max block number that is in mongo
        self.max_block_mongo = None
        # The max block number in the public blockchain
        self.max_block_geth = None
        # Record errors for inserting block data into mongo
        self.insertion_errors = list()
        # Make a stack of block numbers that are in mongo
        self.block_queue = crawler_util.makeBlockQueue(self.mongo_client)
        # The delay between requests to geth
        self.delay = delay

        if start:
            self.max_block_mongo = self.highestBlockMongo()
            self.max_block_geth = self.highestBlockEth()
            self.run()
Exemple #2
0
    def __init__(self,
                 start=True,
                 rpc_port=8545,
                 host="http://127.0.0.1",
                 delay=0):
        """Initialize the Crawler."""
        logging.debug("Starting Crawler")
        self.url = "{}:{}".format(host, rpc_port)
        self.headers = {"content-type": "application/json"}

        # Initializes to default host/port = localhost/27017
        self.mongo_client = crawler_util.initMongo(MongoClient())
        # The max block number that is in mongo
        self.max_block_mongo = None
        # The max block number in the public blockchain
        self.max_block_geth = None
        # Record errors for inserting block data into mongo
        self.insertion_errors = list()
        # Make a stack of block numbers that are in mongo
        self.block_queue = crawler_util.makeBlockQueue(self.mongo_client)
        # The delay between requests to geth
        self.delay = delay

        if start:
            self.max_block_mongo = self.highestBlockMongo()
            self.max_block_geth = self.highestBlockEth()
            self.run()
    def __init__(self,
                 start=True,
                 rpc_port=8545,
                 host="http://localhost",
                 delay=0.0001,
                 mongo_user=None,
                 mongo_pass=None,
                 mongo_host="localhost"):
        """Initialize the Crawler."""
        print("Starting Crawler")
        self.url = "{}:{}".format(host, rpc_port)
        self.headers = {"content-type": "application/json"}

        # Initializes to default host/port = localhost/27017 if not user/pass not specified
        self.mongo_url = None if mongo_user == None or mongo_pass == None else "mongodb://{}:{}@{}/{}".format(
            mongo_user, urllib.parse.quote(mongo_pass), mongo_host, mongo_user)

        self.mongo_client = crawler_util.initMongo(MongoClient()) \
            if mongo_user==None or mongo_pass==None else \
                crawler_util.initMongo(MongoClient(self.mongo_url))

        # The max block number that is in mongo
        self.max_block_mongo = None
        # The max block number in the public blockchain
        self.max_block_geth = None
        # Record errors for inserting block data into mongo
        self.insertion_errors = list()
        # Make a stack of block numbers that are in mongo
        self.block_queue = crawler_util.makeBlockQueue(self.mongo_client)
        # The delay between requests to geth
        self.delay = delay

        self.session = requests.Session()

        if start:
            self.max_block_mongo = self.highestBlockMongo()
            self.max_block_geth = self.highestBlockEth()
            self.run()
Exemple #4
0
 def __init__(self,
              url=[
                  "https://apihk.cybex.io", "https://hongkong.cybex.io",
                  "https://normal-hongkong.cybex.io"
              ],
              delay=0.5):
     logging.debug("Starting Crawler")
     self.url = url
     self.headers = {"content-type": "application/json"}
     self.mongo_client = crawler_util.initMongo(
         MongoClient('mongodb://*****:*****@#') + 'QAZ@localhost/admin'),
         "id")
     self.delay = delay
Exemple #5
0
    def __init__(
            self,
            address,
            collection,
            decimals,
            start=True,
            rpc_port=8545,
            host="http://localhost",
            #rpc_port=18545,
            #host='http://47.97.213.228',
        delay=0.0001):
        """Initialize the Crawler."""
        logging.debug("Starting erc20parser")
        self.url = "{}:{}".format(host, rpc_port)
        self.headers = {"content-type": "application/json"}
        self.collection = collection
        self.decimals = decimals

        # Initializes to default host/port = localhost/27017
        self.mongo_client = crawler_util.initMongo(
            MongoClient('mongodb://*****:*****@localhost/parity'), self.collection)
        #self.mongo_client = crawler_util.initMongo(MongoClient('localhost', 27017))
        # The max block number that is in mongo
        self.max_block_mongo = None
        # The max block number in the public blockchain
        self.max_block_geth = None
        # Record errors for inserting block data into mongo
        self.insertion_errors = list()
        # Make a stack of block numbers that are in mongo
        # The delay between requests to geth
        self.delay = delay
        self.base = 100
        self.address = address
        self.topic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"

        if start:
            self.max_block_mongo = self.highestBlockMongo()
            #self.max_block_mongo = 0
            self.max_block_geth = self.highestBlockEth()
            self.run()