0

Im trying to set up the infinite loop to get the latest currency every 5 seconds and to show up that currency in my terminal but for some reason I see the current currency just once and that's it.

Could you guys please tell me how to improve my code to see the current currency every 5 seconds?

P.S. The programm keeps working without any errors: Here's what I see:

/Users/iprahka/PycharmProjects/Test2/main.py:6: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(executable_path='/Applications/Python 3.10/chromedriver')
[<div class="subPrice">₽1,511,937.64</div>]```


And here's my code:

from threading import Thread
from bs4 import BeautifulSoup
import time
from selenium import webdriver

driver = webdriver.Chrome(executable_path='/Applications/Python 3.10/chromedriver')
def runA():
    while True:

        url = 'https://www.binance.com/trade/BTC_USDT?theme=dark&type=spot'
        driver.get(url)
        time.sleep(5)
        response = driver.page_source
        soup = BeautifulSoup(response, 'html.parser')
        convert = soup.findAll('div', {'class': 'subPrice'})
        print(convert)
        return convert[0].text

if __name__ == "__main__":
    t1 = Thread(target = runA)
    t1.daemon
    t1.start()
    while True:
        pass

Thanks a lot

1 Answer 1

1

Perhaps you should not use return it stops the function

More info

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.