-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (53 loc) · 1.63 KB
/
main.py
File metadata and controls
55 lines (53 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import requests
import json
from bs4 import BeautifulSoup
l=''
s=0
url=requests.get("https://api.coinbase.com/v2/exchange-rates?currency=USDT")
data=url.json()
Final=data["data"]["rates"]["RUB"]
print(Final)
url1=requests.get("https://api.coingecko.com/api/v3/simple/price?ids=tron&vs_currencies=usd&include_last_updated_at=true")
data1=url1.json()
Final1=data1['tron']['usd']
print(Final1)
# url3=requests.get("https://weather.rambler.ru/v-moskve/today/")
# soup = BeautifulSoup(url3.text, "html.parser")
# pres=soup.findAll('span', class_='VaOz d2qU')
r=len('<span class="VaOz d2qU">Давление ')
# f=pres[1]
# f1=str(pres[0])
l1=len('<span class="VaOz d2qU">')
l2=len("</span>")
# l3=len(f1)
# print(f1[l1:l3-l2])
# print(r)
# print(str(f)[r:r+3])
# print(l)
# print(pres)
url4=requests.get("https://ru-meteo.ru/moscow/hour")
soup1 = BeautifulSoup(url4.text, "html.parser")
# print(soup1)
temp=soup1.findAll('div', class_='current-temp')
condit=soup1.findAll('div',class_='conditions')
#wind=soup1.findAll('li', title='Ветер в румбах горизонта (откуда дует)')
#pressure=soup1.findAll('li', title='Атмосферное давление на уровне станции 996.4 гПа')
temp1=str(temp)
temp2=BeautifulSoup(temp1,"html.parser")
# print(temp2)
temp3=temp2.findAll(string=True)
print(temp3)
print(str(temp3[1]))
# print(temp)
condit1=str(condit)
condit2=BeautifulSoup(condit1,"html.parser")
condit3=condit2.findAll(string=True)
print(condit3)
wind1=str(condit3[3])
print(wind1)
pressure1=str(condit3[6])
print(pressure1)
print(condit)
# print(wind)
# print(pressure)
# pres=soup.findAll('span', class_='VaOz d2qU')