[파이썬]텔레그램 푸시(2023버전)
# Script/Python2023. 1. 17. 10:45[파이썬]텔레그램 푸시(2023버전)

파이참을 작성해서 텔레그램 푸시를 테스트해볼려고하니 기존에 사용했던 방식은 먹히지 않아 구글링해본 결과 최근 텔레그램봇이 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 = "#############..

[bash]텔넷 접속 후 명령실행(결과 화면 저장)
# Script/Bash2023. 1. 12. 17:21[bash]텔넷 접속 후 명령실행(결과 화면 저장)

[darksharavim]cat telnet.sh #!/bin/sh tpipe(){ sleep 1; echo 'helo nice' sleep 1; echo 'quit' } tpipe | telnet smtp.nate.com 25 결과를 저장해야할 경우 [darksharavim]cat telnet.sh #!/bin/sh tpipe(){ sleep 1; echo 'helo nice' sleep 1; echo 'quit' } tpipe | telnet smtp.nate.com 25 | tee result.txt [darksharavim]cat result.txt Trying 117.53.114.15... Connected to smtp.nate.com. Escape character is '^]'. 220 *..

[bash]변수 내 문자열 길이 확인
# Script/Bash2023. 1. 12. 15:16[bash]변수 내 문자열 길이 확인

엑셀이 있다면 len함수등으로 글자수를 카운트하겠지만 없을 경우 [darksharavim]cat test.sh #!/bin/bash dark="darksharavim" echo "${#dark}" [darksharavim]sh test.sh 12

[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)
# Script/Python2022. 12. 28. 12:59[파이썬]Beautifulsoup 이용 xml 파씽(기상청 육상 중기예보)

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)..

[파이썬]쿠팡파트너스 워드프레스 자동 포스팅 수정
# Script/Python2022. 12. 26. 14:50[파이썬]쿠팡파트너스 워드프레스 자동 포스팅 수정

어느날부터 자동포스팅이 되지 않아 확인해보니 아래와 같이 에러를 뿜뿜 strIsFreeShipping = bool(productdata[i]['isFreeShipping']) KeyError: 'isFreeShipping' 디버깅해보니 isFreeShipping정보가 사라짐. 관련 내용은 모두 주석처리함. strIsFreeShipping = bool(productdata[i]['isFreeShipping']) if strIsFreeShipping == True: strIFFreeship = '배송비는 무료이며,' else: strIFFreeship = '배송비는 아래 배송도착일 확인 링크에서 확인 가능하며,' ''' + strIFFreeship + ''',

image