반응형
urllib2.request ()
에 시간 제한을 설정해야합니다.
request
의 data code> 매개 변수를 사용하고 있으므로
urllib2.urlopen ()
을 사용하지 않습니다. 어떻게 설정할 수 있습니까?
해결 방법
urlopen
은 POST
에 대해 data code> 매개 변수를 허용하지만
을 호출 할 수 있습니다. > 이와 같은 개체, Request
urlopen
import urllib2
request = urllib2.Request('http://www.example.com', data)
response = urllib2.urlopen(request, timeout=4)
content = response.read()
참조 페이지 https://stackoverflow.com/questions/16646322
반응형
'파이썬' 카테고리의 다른 글
파이썬 2 자리 연도로 문자열 날짜를 구문 분석하는 방법은 무엇입니까? (0) | 2021.01.16 |
---|---|
파이썬 How to dynamically call methods within a class using method-name assignment to a variable (0) | 2021.01.16 |
파이썬에서 날짜에 산술 연산을 수행하는 방법은 무엇입니까? (0) | 2021.01.16 |
파이썬 Finding the indices of matching elements in list in Python (0) | 2021.01.16 |
파이썬 How to get a value from a cell of a dataframe? (0) | 2021.01.16 |
댓글