본문 바로가기

Python/0x01-url5

wget wget class ][ robots.txt 받아오기 1) subprocess 버전 # -*- coding: utf-8 -*- # # write by kyoung chip , jang # # python 3.6 # pip list # import subprocess class CWget : def __init__( self ) : pass def getFile( self, location , url ) : proc = subprocess.Popen( ['wget', '-O',location, url], stdout = subprocess.PIPE ) out,err = proc.communicate() print ( ( "output = %s \nerror = %s") % ( out , err ) ) if.. 2017. 10. 6.
html parser class ][ security focus title과 link정보 가져오기 html parser class ][ security focus title과 link정보 가져오기 # -*- coding: utf-8 -*- # # write by kyoung chip , jang # # python 3.6 # pip list # beautifulsoup4 requests # # pip install bs4 # pip install requests # import requests from bs4 import BeautifulSoup class CHtmlParser : def __init__( self ) : self.req = '' def login( self, url , user , passwd ) : self.req = requests.get( url , auth=(user , pa.. 2017. 10. 5.
html parser class ][ 보안뉴스 가장 많이 본 뉴스 keyword 가져오기 html parser class ][ 보안뉴스 가장 많이 본 뉴스 keyword 가져오기 1) urllib3 버전 # -*- coding: utf-8 -*- # # write by kyoung chip , jang # # python 3.6 # pip list # beautifulsoup4 , urllib3 # # pip install urllib3 # pip install bs4 # import urllib import urllib.request from bs4 import BeautifulSoup class CHtmlParser : def __init__( self ) : self.url = '' self.response = '' def setUrl( self , url ) : self.url = u.. 2017. 10. 3.
request class request class ][ pip install requests # -*- coding: utf-8 -*- # # wirte by kyoung chip , jang # python3.6 # import requests class CRequest : def __init__( self ) : self.req = '' def login( self, site , user , passwd ) : self.req = requests.get( site , auth=(user , passwd) ) print( self.req.text ) def getHtml( self , site ) : self.req = requests.get( site ) print("status code %s" % ( self.req.sta.. 2017. 10. 3.