
import smtplib import imaplib import email import time from email.utils import make_msgid from email.mime.text import MIMEText # SMTP 서버 설정 smtp_server = 'SMTP서버' smtp_port = 465 smtp_username = '사용자ID' smtp_password = '비밀번호' # IMAP 서버 설정 imap_server = 'IMAP서버' imap_port = 993 imap_username = '사용자ID' imap_password = '비밀번호' # 이메일 발신자, 수신자, 제목 및 내용 설정 from_email = '발신자 메일주소' to_email = '수신자 메일주소' ..
![[파이썬]파파고 API 연동](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbEgN6P%2FbtrYszjgXjN%2FAAAAAAAAAAAAAAAAAAAAAMm_0slNIL-NiIyiSqmcvRrBTz3lJpyG613fuMmzLvId%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DW8C9mILiJoEaZVTl3hhSTXMX3p0%253D)
신청 URL https://developers.naver.com/apps/#/register 애플리케이션 - NAVER Developers developers.naver.com 예제 import json import os import sys import urllib.request client_id = "ZOB" # 개발자센터에서 발급받은 Client ID 값 client_secret = "zs" # 개발자센터에서 발급받은 Client Secret 값 #encText = urllib.parse.quote("I'm going to write a blog about Korea, so please let me know in 2000 characters.") encText = urllib.parse.quote("..
![[파이썬]텔레그램 푸시(2023버전)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbVa7Ap%2FbtrWrJBeAov%2FAAAAAAAAAAAAAAAAAAAAAIbXVAtSVXJ0WhuRxsmw_0h_RdkxYacRLUELoHnzh5-I%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3Dx2AUJJ%252B0Pe2memc5wcR%252Bl5NZC6s%253D)
파이참을 작성해서 텔레그램 푸시를 테스트해볼려고하니 기존에 사용했던 방식은 먹히지 않아 구글링해본 결과 최근 텔레그램봇이 v20으로 업데이트 되면서 문제가 발생 해서 아래와 같이 하면 동작. import telegram import asyncio chat_token = "#############################" bot = telegram.Bot(token = chat_token) text = '안녕하세요' #### 리눅스에서는 아래 코드 삭제 또는 주석처리해야함 #### asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.run(bot.sendMessage(chat_id = "#############..
![[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FzoFAp%2FbtrUKXB3cji%2FAAAAAAAAAAAAAAAAAAAAACZEvpohHa3_kd4cmJnp-EAA-Z_6f0vIDuUpQr8oWOD6%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DhY5nYL0iMdwML%252B2WbXjZUvlrEoA%253D)
from bs4 import BeautifulSoup import urllib.request as MyURL japi = 'http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109' response = MyURL.urlopen(japi) weather = BeautifulSoup(response, "html.parser") for location in weather.findAll('location'): print(location.city.string) print("="*20) for data in location.findAll('data'): print("시간:",data.tmef.string) print("날씨:",data.wf.string)..
![[파이썬]쿠팡파트너스 워드프레스 자동 포스팅 수정](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fy8Znt%2FbtrUE6roJTl%2FAAAAAAAAAAAAAAAAAAAAADegGII0UpHag_9-VmVP1xnR3si5LTEhbLUq-5Fkqwmp%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DhYE7lBGdX4fQAgP5dpOE6Aw7n8I%253D)
어느날부터 자동포스팅이 되지 않아 확인해보니 아래와 같이 에러를 뿜뿜 strIsFreeShipping = bool(productdata[i]['isFreeShipping']) KeyError: 'isFreeShipping' 디버깅해보니 isFreeShipping정보가 사라짐. 관련 내용은 모두 주석처리함. strIsFreeShipping = bool(productdata[i]['isFreeShipping']) if strIsFreeShipping == True: strIFFreeship = '배송비는 무료이며,' else: strIFFreeship = '배송비는 아래 배송도착일 확인 링크에서 확인 가능하며,' ''' + strIFFreeship + ''',