Merge branch 'ci/fix_build_examples_v5.0' into 'release/v5.0'

ci(esp_prov): remove import future usage

See merge request espressif/esp-idf!24924
This commit is contained in:
Mahavir Jain 2023-07-20 23:23:31 +08:00
commit bb2e88b27f

View File

@ -6,14 +6,14 @@ from __future__ import print_function
import socket
from future.utils import tobytes
try:
from http.client import HTTPConnection, HTTPSConnection
except ImportError:
# Python 2 fallback
from httplib import HTTPConnection, HTTPSConnection # type: ignore
from utils import str_to_bytes
from .transport import Transport
@ -36,8 +36,9 @@ class Transport_HTTP(Transport):
self.headers = {'Content-type': 'application/x-www-form-urlencoded','Accept': 'text/plain'}
def _send_post_request(self, path, data):
data = str_to_bytes(data) if isinstance(data, str) else data
try:
self.conn.request('POST', path, tobytes(data), self.headers)
self.conn.request('POST', path, data, self.headers)
response = self.conn.getresponse()
if response.status == 200:
return response.read().decode('latin-1')