본문 바로가기
Programing Language/Python

[Python] nonnumeric port

by pcm9881 2023. 5. 30.

해결방법

python3 기준

 

1.  http:// 또는 https:// 제거

예시

# 기존
conn = http.client.HTTPConnection("http://localhost")

# 변경
conn = http.client.HTTPConnection("localhost")

 

 

2.  port 번호 지정

예시

# 기존
conn = http.client.HTTPConnection("localhost:5555")

# 변경
conn = http.client.HTTPConnection("localhost", 5555)

 

 

참조

[python3 docs http.client]: https://docs.python.org/ko/3/library/http.client.html

 

http.client — HTTP protocol client

Source code: Lib/http/client.py This module defines classes that implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the module urllib.request uses it to h...

docs.python.org

728x90

댓글