Enhanced HTTP connection handling
Refactored the HTTP wrapper classes to introduce `HTÜPVerbindung`, a new class that supports configurable timeout, source address, and block size for HTTP connections, enhancing flexibility and control for HTTP requests in the Deuthon project. The `HTÜPAntwort` class now focuses solely on reading the response.
This commit is contained in:
parent
f61f72cb1b
commit
e8dd82a6ba
1 changed files with 22 additions and 3 deletions
|
@ -1,9 +1,28 @@
|
||||||
importiere http.client
|
importiere http.client
|
||||||
|
|
||||||
klasse HTÜPAntwort(http.client.HTTPResponse):
|
klasse HTÜPVerbindung(http.client.HTTPConnection):
|
||||||
definiere __init__(selbst, *argumente, **swargumente):
|
definiere __init__(selbst, gastgeber, anschluss,
|
||||||
super().__init__(*argumente, **swargumente)
|
auszeit=Nichts, quelladdresse=Nicht,
|
||||||
|
blockgröße=Nichts):
|
||||||
|
|
||||||
|
swargumente = {
|
||||||
|
"host": gastgeber,
|
||||||
|
"port": anschluss,
|
||||||
|
}
|
||||||
|
|
||||||
|
falls auszeit:
|
||||||
|
swargumente["timeout"] = auszeit
|
||||||
|
|
||||||
|
falls quelladresse:
|
||||||
|
swargumente["source_address"] = quelladresse
|
||||||
|
|
||||||
|
falls blockgröße:
|
||||||
|
swargumente["blocksize"] = blockgröße
|
||||||
|
|
||||||
|
super().__init__(selbst, **swargumente)
|
||||||
|
|
||||||
|
|
||||||
|
klasse HTÜPAntwort(http.client.HTTPResponse):
|
||||||
definiere lesen(selbst, *argumente, **swargumente):
|
definiere lesen(selbst, *argumente, **swargumente):
|
||||||
return super().read(*argumente, **swargumente)
|
return super().read(*argumente, **swargumente)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue