편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.05.19

    파이썬 주식 top 10 크롤링 후 슬랙 메세지 보내기


    질문이 있어 왔는데요!! 성실한 답변 부탁드립니다.

    def post_message(token, channel, text):
        response = requests.post(
            "https://slack.com/api/chat.postMessage",
            headers={"Authorization": "Bearer "+token},
            data={"channel": channel, "text": text}
        )
        print(response)
    
    myToken = "xoxb-*******************"
    post_message(myToken, "#****", "주식 top 10")
    

    이게 슬랙 메세지 보내는 코드고,

    from bs4 import BeautifulSoup
    import urllib.request as req
    import sys
    import io
    
    sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')
    sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')
    
    url = 'https://finance.naver.com/sise/' 
    res = req.urlopen(url).read().decode('cp949')
    
    soup = BeautifulSoup(res, "html.parser")
    
    top10 = soup.select('#popularItemList > li > a')
    
    print(top10)
    
    for i, e in enumerate(top10, 1):
        print("순위 : {}, 이름 : {}".format(i, e.string))
    

    이건 네이버 증권에서 주식 top10 불러오는 코드인데, 위에 슬랙 메세지 보내는 것을 이 top 10 구하는 코드를 써서 보낼 수 없나요? 있다면 알려주세요~!

  • 프로필 엽토군님의 편집
    날짜2021.05.18

    파이썬 주식 top 10 크롤링 후 슬랙 메세지 보내기


    질문이 있어 왔는데요!! 성실한 답변 부탁드립니다 ㅜㅜ

    def post_message(token, channel, text):
        response = requests.post(
            "https://slack.com/api/chat.postMessage",
            headers={"Authorization": "Bearer "+token},
            data={"channel": channel, "text": text}
        )
        print(response)
    
    myToken = "xoxb-*******************"
    post_message(myToken, "#****", "주식 top 10")
    

    이게 슬랙 메세지 보내는 코드고,

    from bs4 import BeautifulSoup
    import urllib.request as req
    import sys
    import io
    
    sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')
    sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')
    
    url = 'https://finance.naver.com/sise/' 
    res = req.urlopen(url).read().decode('cp949')
    
    soup = BeautifulSoup(res, "html.parser")
    
    top10 = soup.select('#popularItemList > li > a')
    
    print(top10)
    
    for i, e in enumerate(top10, 1):
        print("순위 : {}, 이름 : {}".format(i, e.string))
    

    이건 네이버 증권에서 주식 top10 불러오는 코드인데, 위에 슬랙 메세지 보내는 것을 이 top 10 구하는 코드를 써서 보낼 수 없나요? 있다면 알려주세요~!

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.05.18

    (초초초 코린이) 파이썬 주식 top 10 크롤링 후 슬랙 메세지 보내기


    예비 중 1 되는 잼민이 입니다.. 질문이 있어 왔는데요!! 성실한 답변 부탁드립니다 ㅜㅜ def post_message(token, channel, text): response = requests.post("https://slack.com/api/chat.postMessage", headers={"Authorization": "Bearer "+token}, data={"channel": channel, "text": text} ) print(response) myToken = "xoxb-****************" post_message(myToken, "#*", "주식 top 10")

    이게 슬랙 메세지 보내는 코드고,

    from bs4 import BeautifulSoup import urllib.request as req import sys import io

    sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8') sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')

    url = 'https://finance.naver.com/sise/' res = req.urlopen(url).read().decode('cp949')

    soup = BeautifulSoup(res, "html.parser")

    top10 = soup.select('#popularItemList > li > a')

    print(top10)

    for i, e in enumerate(top10, 1): print("순위 : {}, 이름 : {}".format(i, e.string))

    이건 네이버 증권에서 주식 top10 불러오는 코드인데, 위에 슬랙 메세지 보내는 것을 이 top 10 구하는 코드를 써서 보낼 수 없나요? 있다면 알려주세요~!