회원 로그인
|
웹 파싱, 웹 클라이언트 프로그래밍 httplib
웹 파싱, 웹 클라이언트 프로그래밍 httplib
urllib, BeautifulSoup 웹 파싱 이외에도 httplib이 있다.
웹 정보를 가져오며 여러가지 socket 에러가 발생하는데 프로그램이 먹통이 되면 timeout을 설정 해주며 되고,
http://old.wikidocs.net/read/1603
http://www.hanbit.co.kr/network/view.html?bi_id=567
http://stackoverflow.com/questions/18832643/how-to-catch-this-python-exception-error-errno-10054-an-existing-connection
http://noon.tistory.com/186 (socket 에러 설명)
urllib, BeautifulSoup 웹 파싱 이외에도 httplib이 있다.
import httplib host_ = 'dvframes.com' h_ = httplib.HTTP(host_) h_.putrequest('GET', '/rb/?r=home&c=project/apps') h_.putheader('Host', host_) h_.putheader('Accept', 'text/html') h_.putheader('Cache-Control', 'no-cache') h_.endheaders() errcode, errmsg, headers = h_.getreply() f_ = h_.getfile() text_ = f_.read() f_.close()text_ 변수로 웹페이지의 소스를 얻을 수 있다.
웹 정보를 가져오며 여러가지 socket 에러가 발생하는데 프로그램이 먹통이 되면 timeout을 설정 해주며 되고,
socket.setdefaulttimeout(초)기타 에러가 발생되면 try ~ except를 이용하여 해결한다.
try: ...... except socket.error as error: if error.errno == errno.WSAENETRESET: print "네트워크가 연결되지 않았습니다."참고)
http://old.wikidocs.net/read/1603
http://www.hanbit.co.kr/network/view.html?bi_id=567
http://stackoverflow.com/questions/18832643/how-to-catch-this-python-exception-error-errno-10054-an-existing-connection
http://noon.tistory.com/186 (socket 에러 설명)
댓글 0개
| 엮인글 0개
285개(11/15페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
85 | [C#] 생성자와 상속 base | 푸딩뱃살 | 3724 | 2014.11.21 02:09 |
84 | [C#] 클래스 상속 | 푸딩뱃살 | 3806 | 2014.11.17 23:35 |
83 | [C#] 클래스 예제 | 푸딩뱃살 | 3282 | 2014.11.03 23:03 |
82 | [C#] Main() 메소드 | 푸딩뱃살 | 3196 | 2014.11.02 23:43 |
81 | [C#] 인덱서 | 푸딩뱃살 | 2698 | 2014.11.01 01:09 |
80 | [C#] 속성 | 푸딩뱃살 | 2736 | 2014.11.01 00:41 |
79 | [C#] 생성자 | 푸딩뱃살 | 2846 | 2014.10.27 01:48 |
78 | [C#] public, private | 푸딩뱃살 | 3075 | 2014.10.25 22:32 |
77 | [C#] 오버로드(overload) | 푸딩뱃살 | 2664 | 2014.10.22 23:02 |
>> | [Python] 웹 파싱, 웹 클라이언트 프로그래밍 httplib | 푸딩뱃살 | 3464 | 2014.10.06 00:46 |
75 | [C#] 스코프(scope) | 푸딩뱃살 | 3272 | 2014.10.02 01:17 |
74 | [C#] 메소드 호출 | 푸딩뱃살 | 2714 | 2014.10.02 00:46 |
73 | [C#] 메소드(method) | 푸딩뱃살 | 3248 | 2014.10.02 00:30 |
72 | [C#] 필드(field) | 푸딩뱃살 | 3132 | 2014.10.02 00:06 |
71 | [C#] 객체(object)의 생성 | 푸딩뱃살 | 3604 | 2014.10.01 23:36 |
70 | [C#] 클래스(class)의 개념 | 푸딩뱃살 | 3511 | 2014.10.01 22:29 |
69 | [기본] 용어 - 클래스, 객체, 인스턴스, 메소드, 필드 | 푸딩뱃살 | 3948 | 2014.05.29 11:36 |
68 | [Python] Python 프로세스 리스트 추출 | 푸딩뱃살 | 8615 | 2014.05.20 16:02 |
67 | [Python] Python 환경 변수 설정 | 푸딩뱃살 | 4221 | 2014.05.20 12:46 |
66 | [Python] Python console 컬러 출력 | 푸딩뱃살 | 5192 | 2014.05.14 22:23 |