Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/Can i fix the “client sent an http request to an https server” or not?
Next
Answered
Elizabeth Morton
  • 13
Elizabeth Morton
Asked: May 18, 20222022-05-18T21:13:46+00:00 2022-05-18T21:13:46+00:00In: python

Can i fix the “client sent an http request to an https server” or not?

  • 13

. Advertisement .

..3..

. Advertisement .

..4..

I get the error message:

Traceback (most recent call last):
  File "app.py", line 591, in <module>
  get_horas_stock()
  File "app.py", line 513, in get_horas_stock
  df_temp = influx_temperatura.multiple_query_to_df(queries_temperatura)
  File "/usr/src/app/analitica_py_lib_conexiones/conexion_influx.py", line 82, in multiple_query_to_df
  resultado = self.__cliente.query(";".join(queries))
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 445, in query
  response = self.request(
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 302, in request
  raise InfluxDBClientError(response.content, response.status_code)
 influxdb.exceptions.InfluxDBClientError: 400: Client sent an HTTP request to an HTTPS server.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 360, in _error_catcher
  yield
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 442, in read
  data = self._fp.read(amt)
  File "/usr/local/lib/python3.8/http/client.py", line 454, in read
  n = self.readinto(b)
  File "/usr/local/lib/python3.8/http/client.py", line 498, in readinto
  n = self.fp.readinto(b)
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
  return self._sock.recv_into(b)
 ConnectionResetError: [Errno 104] Connection reset by peer
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 750, in generate
  for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 494, in stream
  data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 459, in read
  raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
  self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 378, in _error_catcher
  raise ProtocolError('Connection broken: %r' % e, e)
 urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
  File "app.py", line 591, in <module>
  get_horas_stock()
  File "app.py", line 513, in get_horas_stock
  df_temp = influx_temperatura.multiple_query_to_df(queries_temperatura)
  File "/usr/src/app/analitica_py_lib_conexiones/conexion_influx.py", line 82, in multiple_query_to_df
  resultado = self.__cliente.query(";".join(queries))
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 445, in query
  response = self.request(
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 274, in request
  response = self._session.request(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
  resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 686, in send
  r.content
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 828, in content
  self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 753, in generate
  raise ChunkedEncodingError(e)
 requests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
~$ python3 app.py
 Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/response.py", line 360, in _error_catcher
  yield
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/response.py", line 442, in read
  data = self._fp.read(amt)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 457, in read
  n = self.readinto(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 501, in readinto
  n = self.fp.readinto(b)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto
  return self._sock.recv_into(b)
 ConnectionResetError: [Errno 54] Connection reset by peer
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 750, in generate
  for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/response.py", line 494, in stream
  data = self.read(amt=amt, decode_content=decode_content)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/response.py", line 459, in read
  raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
  self.gen.throw(type, value, traceback)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/response.py", line 378, in _error_catcher
  raise ProtocolError('Connection broken: %r' % e, e)
 urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer')", ConnectionResetError(54, 'Connection reset by peer'))
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
  File "app.py", line 1272, in <module>
  generate_excels_consumo()
  File "/Volumes/DATA/IdeaProjects/australia/analitica_py_sw_recolect_info/calculo_excels.py", line 206, in generate_excels_consumo
  df_sector = influx_kpis.multiple_query_to_multiple_df(queries)
  File "/Volumes/DATA/IdeaProjects/australia/analitica_py_sw_recolect_info/analitica_py_lib_conexiones/conexion_influx.py", line 126, in multiple_query_to_multiple_df
  resultado = self.__cliente.query(";".join(query))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/influxdb/client.py", line 450, in query
  expected_response_code=expected_response_code
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/influxdb/client.py", line 283, in request
  timeout=self._timeout
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
  resp = self.send(prep, **send_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 686, in send
  r.content
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 828, in content
  self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 753, in generate
  raise ChunkedEncodingError(e)
 requests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer')", ConnectionResetError(54, 'Connection reset by peer'))

Has anyone ever faced this problem? How to troubleshoot the “client sent an http request to an https server.” The problem appears when I try to operate the following program:

FROM python:3.8.2-buster
 
 WORKDIR /usr/src/app
 
 COPY . .
 
 RUN pip install --no-cache-dir -r requirements.txt
 
 EXPOSE 8080
 
 CMD ["python", "app.py"]
apiVersion: apps/v1
 kind: Deployment
 metadata:
  name: my-ms
 spec:
  replicas: 1
  selector:
  matchLabels:
  ip-service: my-ms
  template:
  metadata:
  labels:
  ip-service: my-ms
  spec:
  containers:
  - name: my-ms
  image: myprivate.azurecr.io/my-ms:latest
  ports:
  - containerPort: 8080
  resources:
  requests:
  cpu: 100m
  memory: 10Mi
  imagePullSecrets:
  - name: tecnoregistry

client sent an http request to an https server
  • 2 2 Answers
  • 243 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    hdtutoria Expert
    2022-06-24T04:05:46+00:00Added an answer on June 24, 2022 at 4:05 am

    The cause: This can be a Network issue.

    Solution: You can fix this error by these ways below:

    1.  Perform this command traceroute <cluster-ip> and check the container is attached to the cluster inside the container before running the command docker exec -it container /bin/bash.
    2. Check Proxy. export check environment variables related with proxy.
    3. curl www.google.com
    4. Consider connecting more items in the cluster. Eg MySQL, etc.
    5. Try to use python-slim image. Slim image is based from ubuntu.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Paul Dubois
    2022-05-26T03:55:30+00:00Added an answer on May 26, 2022 at 3:55 am

    It appears to be a network problem. Proxy caused smiler problem when I tried to connect to MongoDB. This problem could happen to anyone.

    Docker defaults to each container running in its own network namespace.

    Offering Some Solution Methods:

    1. traceroute <cluster-ip> Perform this command to check if clusters are present inside the container. Attach container and execute the command docker exec -it container /bin/bash.
    2. Proxy. Proxy environment variables export related to proxy
    3. curl www.google.com
    4. Connect other things to the cluster. For example MySQL, etc. (Once upon a time, a machine wrote me blacklist automatically. I tried to fix connection problem 2 days later).
    5. Use python slim image. The base of the slim image is Ubuntu.

    This is a great document that can be used to solve the docker connection problem.


    https://pythonspeed.com/articles/docker-connection-refused/

    • 21
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.