Compare commits

..

No commits in common. "9e841014de8f36dc284853190946096a1d05778d" and "679e5c37f33d169ad0b5e4c3f74e09b1fccb0158" have entirely different histories.

2 changed files with 2 additions and 17 deletions

6
.gitattributes vendored
View File

@ -1,6 +0,0 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
* text=auto eol=lf

13
main.py
View File

@ -20,7 +20,7 @@ if (site.status_code != 200):
soup = BeautifulSoup(site.text, "html.parser")
for tag in soup.find_all("div", class_="snow-price_SnowPrice__mainS__ugww0l"):
for tag in soup.find_all("span", class_="product-price-current"):
KursAli = (''.join(x for x in tag.text if (x.isdigit() or x == ','))).replace(',','.')
print("Курс Ali: " + KursAli)
@ -36,8 +36,6 @@ if (site.status_code != 200):
KursCBRF = str(json.loads(site.text)["Valute"]["USD"]["Value"])
print("Курс ЦБ РФ: " + KursCBRF)
print("Разница Ali и CBRF", round(max(float(KursAli), float(KursCBRF)) - min(float(KursAli), float(KursCBRF)), 2))
# Send metrics ↓
url = MetricServerURL + 'api/v1/import/csv?format=1:label:source,2:metric:exchange_usd_rub'
@ -54,11 +52,4 @@ if KursAli != '':
if (x.status_code != 200 and x.status_code != 204):
print("Не удалось отправить метрику: " + str(x.status_code))
else:
print("Курс Али пуст")
if KursCBRF != '' and KursAli != '':
x = requests.post(url, "Diff Ali CBRF," + str(round(max(float(KursAli), float(KursCBRF)) - min(float(KursAli), float(KursCBRF)), 2)))
if (x.status_code != 200 and x.status_code != 204):
print("Не удалось отправить метрику: " + str(x.status_code))
else:
print("Один из курсов пуст")
print("Курс Али пуст")