first commit

This commit is contained in:
2024-10-29 16:09:13 +03:00
commit 8bdd4be9b0
42 changed files with 2605 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import lxml
import requests
from bs4 import BeautifulSoup
headers = {
'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36'
}
def get_location(url):
response = requests.get(url=url, headers=headers)
soup = BeautifulSoup(response.text, 'lxml')
bitcoin_USD = soup.find('div', class_='chart__subtitle js-chart-value').text.strip()[:10:].strip()
bitcoin_USD_STR= f'BTC/USD: ({bitcoin_USD}$)'
return bitcoin_USD_STR
def print_bitcoin():
bitcoin_USD = get_location(url='https://www.rbc.ru/crypto/currency/btcusd')
#print(bitcoin_USD)
return bitcoin_USD
def main():
bitcoin_USD_STR = get_location(url='https://www.rbc.ru/crypto/currency/btcusd')
print(bitcoin_USD_STR)
if __name__ == '__main__':
main()