3
I am new in Python and I am doing a project... however I was running this and gave an error in line 44, whose message is:
Indentationerror: expected an indented block
import blockchain, threading, requests
coins_API = ["https://www.mercadobitcoin.net/api/BTC/ticker/", "www.exemplo.com", "www.exemplo.com"]
cc_names = ["Bitcoin", "Litecoin", "Etherum"]
btc_prices = []
ltc_prices = []
eth_prices = []
class wallet:
def start():
print("Starting BitBot!")
prices.start()
WALLETID = raw_input("Insert the Wallet ID: ")
PASSWORD = raw_input("Insert your passoword: ")
HOST = "https://blockchain.info"
#checking_coin_prices.start()
wallet_conn(WALLETID, PASSWORD, HOST)
def wallet_conn(WALLETID, PASSWORD, HOST):
try:
print("Trying the connection with the wallet: ")
current_wallet = wallet(WALLETID, PASSWORD, HOST)
except:
print("Login Unknown error!")
class prices:
def start():
print("Searching for prices!")
while 1:
for i in range(0, len(cc_names)):
if i == 0:
btc_prices.append(get_cc_price())
if i == 1:
ltc_prices.append(get_cc_price())
if i == 2:
eth_prices.append(get_cc_price())
if btc_prices >= eth_prices:
#To do buy and sell prices!
def get_cc_price(): #Erro de identação aqui! <-----------------------------
for i in range(0, len(cc_names)):
print("Checking the {} price!", .format(cc_names[i]))
try:
cc_price = requests.get(coins_API[i])
print(cc_price.status_code)
print(cc_price.json())
if i == 0:
return conversions.usd_to_brl(cc_price["last"])
else:
return conversions,usd_to_brl(cc_price)
except:
print("Error while checking the {} price!", .format(cc_names[i]))
return 0
class conversions:
def usd_to_brl(cc_usd_price):
print("Converting the cryptocoin price!")
try:
brl_price = requests.get("")
print(brl_price.status_code)
return cc_usd_price * brl_price
except:
print("Error while converting the cryptocoin price!")
return 0
#checking_coin_prices = threading.Thread(target=prices.start)
wallet.start()
Thanks friend! The code worked perfectly!
– Matheus Grossi