[Scraping] 환율 정보를 SMS로 보내기
Machine Learning 2024. 1. 2. 19:04 |반응형
네이버에서 환율 정보를 scraping 하고 IFTTT를 이용해 SMS로 보낸다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from bs4 import BeautifulSoup as bs
import urllib.request as req
import requests
url = 'https://finance.naver.com/marketindex/' # 시장지표: 네이버 금융
res = req.urlopen(url)
soup = bs(res, 'html.parser')
title = soup.select_one('a.head > h3.h_lst').string
rate = soup.select_one('div.head_info > span.value').string
# IFTTT Platform
# To trigger an Event make a POST or GET web request to:
trigger_url = 'https://maker.ifttt.com/trigger/이벤트_입력/with/key/키_입력'
# With an optional JSON body of:
result = requests.post(trigger_url, data = { "value1" : title, "value2" : rate, "value3" : 'Sean' })
# The data is completely optional, and you can also pass value1, value2, and value3 as query parameters
# or form variables. This content will be passed on to the Action in your Recipe.
print('Result:', result, result.status_code, result.reason)
|
반응형
'Machine Learning' 카테고리의 다른 글
[ML] MNIST pandas (0) | 2024.12.21 |
---|---|
[Scraping] 환율 정보 (0) | 2024.01.02 |
OCR with Tesseract on Windows - Windows에서 테서랙트 사용하기 (0) | 2020.10.07 |
CSV 분석 (0) | 2019.01.20 |
JSON 분석 (0) | 2019.01.18 |