Phython2019. 7. 5. 10:59

DownloadManager.py 

텔레그램에서 "찾기 '드라마'"  하면 리스트가 나오고 받을 번호를 선택하면 시놀로지에 자동으로 다운되고 다운이 완료 되면 시드는 삭제 된다.

 

AutoDownload.py

지정된 드라마를 3시간 간격으로 검색해서 매일 다운로드

 

Mediamon.py

다운받는 즉시 DLNA를 이용해서 TV에서 볼수 있게 MOVIE폴더에 파일이 감지되면 색인서비스를 자동 실행하게 해준다.

 

BitAlert.py

텔레그램봇이 비트코인 가격을 알려주고 "범위 100" 이렇게 하면 가격변동이 100이상시에 알림을 준다.

 

ScrectDown.py

vpn을 수동으로 on, off 하여 차단사이트를 무시하고 웹크롤링을 하여 다운로드 한후 텔레그램으로 알려준다.

 

AlertWeb

뽐뿌 웹크롤링을 해서 해피머니나 컬쳐랜드가 나오면 텔레그램으로 알려준다.

 

 

 

Python.zip
1.67MB

Posted by 동동(이재동)
Phython2019. 5. 28. 17:03

for a in soup.find_all('h6', {'class' : 'ellipsis'}):

    print(a.find('a').attrs['href'])

Posted by 동동(이재동)
Phython2019. 5. 28. 15:54

정부에서 차단된 사이트를 웹크롤링 하기 위해서 사용했다..

 

일단 공개된 vpn을 이용

 

https://www.vpngate.net/en/

 

VPN Gate - Public Free VPN Cloud by Univ of Tsukuba, Japan

Follow @vpngate Free Access to World Knowledge Beyond Government's Firewall. Your IP: 27.0.238.117Your country: Korea Republic ofLet's change your IP address by using VPN Gate! Today: 3,263,597 connections, Cumulative: 5,606,897,919 connections, Traffic: 1

www.vpngate.net

 

openVpn을 이용해서 ovpn 파일을 얻는다.

 

그리고 공개된 아이디와 패스워드 vpn/vpn으로 시놀리지 

 

제어판 - 네트워크 - 일반- 고급설정에서 다중게이트 활성화를 하고

 

네트워크 인터페이스로 이동하여 vpn 프로 파일 생성후 아이디 패스워드를 입력하고 vpn 끊어지면 다시 접속을 체크 한다.

 

그리고 생성되면 오른쪽 버튼을 눌러서 연결되면 이제부터 차단된사이트를 이용할수 있다.

Posted by 동동(이재동)
Phython2019. 5. 21. 12:34

 

글로벌 변수를 사용할려면  global을 메소드안에서 선언해 줘야 한다.

x = 10

 

def foo():

 global x

 x += 1

 print x

 

foo()

https://eli.thegreenplace.net/2011/05/15/understanding-unboundlocalerror-in-python

'Phython' 카테고리의 다른 글

beautifulsoup에서 링크만 빼는법  (0) 2019.05.28
시놀리지에서 vpn client 사용하는 방법  (0) 2019.05.28
파이썬에서 텔레그램 메세지 에코  (0) 2019.05.21
파이썬 simple json 파싱  (0) 2019.05.17
파이썬 web request  (0) 2019.05.17
Posted by 동동(이재동)
Phython2019. 5. 21. 12:01

from telegram.ext import Updater

from telegram.ext import CommandHandler

from telegram.ext import MessageHandler, Filters

 

 

def start(bot, update):

# Your bot will send this message when users first talk to it, or when they use the /start command

bot.sendMessage(chat_id=update.message.chat_id,

text="Hi. Send me any English text and I'll summarize it for you.")

 

def summarize(bot, update):

try:

# Get the text the user sent

text = update.message.text

bot.sendMessage(chat_id=update.message.chat_id,

text=text)

#print(text)

# Run it through the summarizer

except UnicodeEncodeError:

bot.sendMessage(chat_id=update.message.chat_id,

text="Sorry, but I can't summarise your text.")

 

updater = Updater(token=my_token)

dp = updater.dispatcher

 

summarize_handler = MessageHandler(Filters.text, summarize)

start_handler = CommandHandler('start', start)

 

dp.add_handler(summarize_handler)

dp.add_handler(start_handler)

 

dp.bot.sendMessage('사람 id',text="himan")

 

updater.start_polling(timeout=3,clean=True)

updater.idle()

 

Commandhander를 앞에 /나 @에 반응한다.

 

참고 :  https://blog.psangwoo.com/coding/2018/01/09/python-telegram-bot-3.html

 

Posted by 동동(이재동)
Phython2019. 5. 17. 14:27

import json

 

x = json.loads("json string", object_hook=lambda d: namedtuple('X', d.keys())(*d.values()))

print(x.last_price)

Posted by 동동(이재동)
Phython2019. 5. 17. 14:26

import requests

 

url = 'https://api.bitfinex.com/v1/pubticker/btcusd'

response = requests.get(url)

response.status_code

response.text

 

print(response.text)

 

 

Posted by 동동(이재동)