- 전체
- Python 일반
- Python 수학
- Python 그래픽
- Python 자료구조
- Python 인공지능
- Python 인터넷
- Python SAGE
- wxPython
- TkInter
- iPython
- wxPython
- pyQT
- Jython
- django
- flask
- blender python scripting
- python for minecraft
- Python 데이터 분석
- Python RPA
- cython
- PyCharm
- pySide
- kivy (python)
Python 인터넷 python 활용 웹 사이트가 존재하는지 체크 : Python check if website exists
2018.01.16 16:45
python 활용 웹 사이트가 존재하는지 체크 :
Python check if website exists
You can use HEAD request instead of GET. It will only download the header, but not the content. Then you can check the response status from the headers.
import httplib
c = httplib.HTTPConnection('www.example.com')
c.request("HEAD", '')
if c.getresponse().status == 200:
print('web site exists')
or you can use urllib2
import urllib2
try:
urllib2.urlopen('http://www.example.com/some_page')
except urllib2.HTTPError, e:
print(e.code)
except urllib2.URLError, e:
print(e.args)
or you can use requests
import requests
request = requests.get('http://www.example.com')
if request.status_code == 200:
print('Web site exists')
else:
print('Web site does not exist')
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 4 |
[Cython] [Python] 고성능 Python을 위한 Cython 활용하기 3편
| 졸리운_곰 | 2024.06.10 | 405 |
| 3 |
[Cython][Python] 고성능 Python을 위한 Cython 활용하기 2편
| 졸리운_곰 | 2024.06.10 | 361 |
| 2 |
[Cython] [Python] 고성능 Python을 위한 Cython 활용하기 1편
| 졸리운_곰 | 2024.06.10 | 553 |
| 1 | cython 튜토리얼 Cython 시작하기 | 졸리운_곰 | 2022.11.13 | 635 |

