1

get values from multiple searches or responses from url at a same time (concurrently). how to do it? using Beautifulsoup

here is my code

import requests
import time
import sha3
from bs4 import BeautifulSoup
from ecdsa import SigningKey, SECP256k1
  start = time.time()
i = 1
while(i<=100):
    t_time = time.time() - start
 # i want first generate address first for example i'm given 100 address generate take time 0.125sec
# one address generate scan show balance and token take 100 address 115 second this time saving way need code bro
     keccak = sha3.keccak_256()
    priv = SigningKey.generate(curve=SECP256k1)
    pub = priv.get_verifying_key().to_string()
    keccak.update(pub)
    address = keccak.hexdigest()[24:]
 # first address generate gone, before show balance and token number\
# After scan multiple searcing  url set need bro, EXA: same time scan multiple address reduce time
# For example same time multiple address scan show balance and Token. this set searcing time save.....
     url = ("https://etherscan.io/address/" + address)
    html = requests.get(url, headers={'user-agent': 'Mozilla/5.0'}).text
    soup = BeautifulSoup(html, "html.parser")
    box = soup.find("div", class_="col-md-6 mb-3 mb-md-0")
    data = box.find_all('div', class_='col-md-8')
     try:
        balance = data[0].text.split(' ')[0].strip()
 # token only show number only exa: 0x**********************************[hidden] : This address have 9 token number
        token = data[2].text.split(' ')[0].strip()
     except IndexError:
        token = 0
        print (address+"  "+balance+"  "+str(token))
    print (t_time)
     i = i + 1

Answered question