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

CI: fix build examples import future

See merge request espressif/esp-idf!24864
This commit is contained in:
Mahavir Jain 2023-07-21 12:40:11 +08:00
commit 3187b8b326

View File

@ -6,14 +6,14 @@ from __future__ import print_function
import socket import socket
from future.utils import tobytes
try: try:
from http.client import HTTPConnection, HTTPSConnection from http.client import HTTPConnection, HTTPSConnection
except ImportError: except ImportError:
# Python 2 fallback # Python 2 fallback
from httplib import HTTPConnection, HTTPSConnection # type: ignore from httplib import HTTPConnection, HTTPSConnection # type: ignore
from utils import str_to_bytes
from .transport import Transport from .transport import Transport
@ -36,8 +36,9 @@ class Transport_HTTP(Transport):
self.headers = {'Content-type': 'application/x-www-form-urlencoded','Accept': 'text/plain'} self.headers = {'Content-type': 'application/x-www-form-urlencoded','Accept': 'text/plain'}
def _send_post_request(self, path, data): def _send_post_request(self, path, data):
data = str_to_bytes(data) if isinstance(data, str) else data
try: try:
self.conn.request('POST', path, tobytes(data), self.headers) self.conn.request('POST', path, data, self.headers)
response = self.conn.getresponse() response = self.conn.getresponse()
# While establishing a session, the device sends the Set-Cookie header # While establishing a session, the device sends the Set-Cookie header
# with value 'session=cookie_session_id' in its first response of the session to the tool. # with value 'session=cookie_session_id' in its first response of the session to the tool.