mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
fix
This commit is contained in:
parent
335ea3ae51
commit
9a6eb2f00f
@ -68,6 +68,7 @@ class ResponseBase:
|
|||||||
self.cookies = {}
|
self.cookies = {}
|
||||||
self.status_code = 0
|
self.status_code = 0
|
||||||
self.__content = b""
|
self.__content = b""
|
||||||
|
self.__content_s = []
|
||||||
self.content_prepared = threading.Event()
|
self.content_prepared = threading.Event()
|
||||||
self.interonce = True
|
self.interonce = True
|
||||||
|
|
||||||
@ -77,10 +78,15 @@ class ResponseBase:
|
|||||||
for _ in self.iter_content():
|
for _ in self.iter_content():
|
||||||
pass
|
pass
|
||||||
self.content_prepared.wait()
|
self.content_prepared.wait()
|
||||||
|
if self.stream:
|
||||||
|
return b"".join(self.__content_s)
|
||||||
|
else:
|
||||||
return self.__content
|
return self.__content
|
||||||
|
|
||||||
@content.setter
|
@content.setter
|
||||||
def content(self, c):
|
def content(self, c):
|
||||||
|
if self.stream:
|
||||||
|
raise RequestException()
|
||||||
self.__content = c
|
self.__content = c
|
||||||
self.content_prepared.set()
|
self.content_prepared.set()
|
||||||
|
|
||||||
@ -110,7 +116,7 @@ class ResponseBase:
|
|||||||
self.interonce = False
|
self.interonce = False
|
||||||
|
|
||||||
for chunk in self.iter_content_impl(chunk_size):
|
for chunk in self.iter_content_impl(chunk_size):
|
||||||
self.__content += chunk
|
self.__content_s.append(chunk)
|
||||||
if decode_unicode:
|
if decode_unicode:
|
||||||
yield chunk.decode("utf8")
|
yield chunk.decode("utf8")
|
||||||
else:
|
else:
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 31)
|
set(VERSION_MINOR 31)
|
||||||
set(VERSION_PATCH 3)
|
set(VERSION_PATCH 4)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user