Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code problem #31

Open
daniil2327 opened this issue Sep 12, 2023 · 0 comments
Open

Code problem #31

daniil2327 opened this issue Sep 12, 2023 · 0 comments

Comments

@daniil2327
Copy link

daniil2327 commented Sep 12, 2023

from time import sleep
import requests
import json
from btcaddr import Wallet
from time import sleep
from fake_user_agent import user_agent

def generate_addresses(count):
addresses = {}
for i in range(count):
wallet = Wallet()
pub = wallet.address.dict["mainnet"].dict["pubaddr1"]
prv = wallet.key.dict["mainnet"].dict["wif"]
addresses[pub] = prv
return addresses

def check_balance_btc():
try:
data=generate_addresses(20)
addresses = "|".join(data.keys())
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Firefox/116.0"
}
url = f"https://blockchain.info/multiaddr?active={addresses}"
response = requests.get(url, headers=headers).json()
sleep(0.5)
extract = []
for address in response["addresses"]:
# add all data into a list
extract.append({
"address": address["address"],
"balance": address["final_balance"],
"private": data[address["address"]]
})
return extract
except:
pass
generate_addresses(10)


New code for check.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant