일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- PyQt5
- GIT
- mssql
- ubuntu
- 유니티
- 함수
- 리눅스
- MySQL
- urllib
- MS-SQL
- PyQt
- flutter
- 라즈베리파이
- javascript
- swift
- ASP
- Excel
- port
- pandas
- tensorflow
- 날짜
- 맛집
- Unity
- PER
- 다이어트
- Linux
- node.js
- sqlite
- IOS
- python
목록urllib2 (4)
아미(아름다운미소)
HTTP GET in Python Python 3: import urllib.request contents = urllib.request.urlopen("http://test.com/?name=test&tel=01022223333").read() Python 2: import urllib2 contents = urllib2.urlopen("http://test.com/?name=test&tel=01022223333").read()
urllib2를 사용하여 요청하기 전에 프록시 를 설정할 수 있습니다 . proxy = urllib2.ProxyHandler({'http': '127.0.0.1'}) opener = urllib2.build_opener(proxy) urllib2.install_opener(opener) urllib2.urlopen('http://www.google.com')
파이썬에서 파일을 다운로드하는 방법- Python 2에서 파일을 다운로드하는 방법 import urllib urllib.urlretrieve ("http://www.example.com/songs/mp3.mp3", "mp3.mp3") (Python 3+에서는 'import urllib.request'와 urllib.request.urlretrieve를 사용하십시오) - 파이썬에서 파일을로드하는 방법(진행 표시 줄) import urllib2 url = "http://download.thinkbroadband.com/10MB.zip" file_name = url.split('/')[-1] u = urllib2.urlopen(url) f = open(file_name, 'wb') meta = u.info()..
HTTP 요청을 전송하면, html이나 이미지 또는 비디오 등등이 돌아온다.어떤 경우에는 받고 있는 데이터의 유형이 예상대로 인지 점검해야 한다. 받고 있는 문서의 유형을 점검하려면, MIME 유형을 보자 (Content-type) 헤더:urlfile = urllib2.urlopen('http://www.commentcamarche.net/') print "Document type is", urlfile.info().getheader("Content-Type","") 이는 다음과 같이 출력된다:Document type is text/html 경고: 쌍반점 다음에 정보가 있을 수 있다. 예를 들어:Document type is text/html; charset=iso-8859-1 그래서 언제나 다음과 같이..