This commit is contained in:
恍兮惚兮 2024-08-29 22:34:44 +08:00
parent 335ea3ae51
commit 9a6eb2f00f
2 changed files with 9 additions and 3 deletions

View File

@ -68,6 +68,7 @@ class ResponseBase:
self.cookies = {}
self.status_code = 0
self.__content = b""
self.__content_s = []
self.content_prepared = threading.Event()
self.interonce = True
@ -77,10 +78,15 @@ class ResponseBase:
for _ in self.iter_content():
pass
self.content_prepared.wait()
return self.__content
if self.stream:
return b"".join(self.__content_s)
else:
return self.__content
@content.setter
def content(self, c):
if self.stream:
raise RequestException()
self.__content = c
self.content_prepared.set()
@ -110,7 +116,7 @@ class ResponseBase:
self.interonce = False
for chunk in self.iter_content_impl(chunk_size):
self.__content += chunk
self.__content_s.append(chunk)
if decode_unicode:
yield chunk.decode("utf8")
else:

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 31)
set(VERSION_PATCH 3)
set(VERSION_PATCH 4)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)