• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

http: error: ConnectionError

22.05.02 00:12 작성 조회수 2.42k

0

터미널에서 http GET http://localhost:8081/json_test를 실행하면 아래와 같은 에러가 나옵니다. 포트번호를 8080/8081/8082등 무점유(무실행) 상태에서 바꿔봐도 동일한 에러가 나와 터미널에서 rest api test 실행이 안됩니다. 어떻게 해야 해결이 될지 조언 바랍니다.

http: error: ConnectionError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /json_test (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb080e29fd0>: Failed to establish a new connection: [Errno 61] Connection refused')) while doing a GET request to URL: http://localhost:8081/json_test

 

http -v GET http://localhost:8081/json_test로 실행하면

아래와 같이 나옵니다. python version 문제 일까요? 참고로 제 사용 버전은 3.9.12 입니다.

GET /json_test HTTP/1.1

Accept: */*

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Host: localhost:8081

User-Agent: HTTPie/3.1.0

 

http: error: ConnectionError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /json_test (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7feea0c29f40>: Failed to establish a new connection: [Errno 61] Connection refused')) while doing a GET request to URL: http://localhost:8081/json_test

답변 1

답변을 작성해보세요.

0

안녕하세요.

 

우선 둘다 결과적으로 다음과 같은 에러가 나는 것 같은데요.

 

Max retries exceeded with url

 

이 부분은 너무 많이 동일한 API 를 호출했다고 하는 것 같아요. 보통은 다음 링크처럼, 이러한 에러는 단기간에 반복문이든, 여러 반복적 테스트든 단기간에 요청을 너무 많이 하셔서 나타나는 문제이거든요.

https://www.codeit.kr/community/threads/32453

 

그렇다면, 조금 시간이 지난 후에 단 한번만 호출해보신다면, 문제가 없어야 할 듯 합니다 이 부분은 아마도 하루정도는 최소한 시간이 지났을 것이라서, 현재는 일어나지 않을 것 같습니다.

 

감사합니다.

ohwhy님의 프로필

ohwhy

질문자

2022.05.04

오늘 flask CORS 강의때 터미널에서 http 명령어가 잘 실행되네요~ 답변 감사합니다.