fix: pass headers through KeyedWriterFactory
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7b7fd1e2bb
commit
de78753675
@ -52,7 +52,7 @@ class HTTPWriter(OutputWriter):
|
|||||||
path = self.path
|
path = self.path
|
||||||
if k is not None:
|
if k is not None:
|
||||||
path = os.path.join(path, k)
|
path = os.path.join(path, k)
|
||||||
logg.debug(f"http writer post {path} \n key: {k}, value: {v}")
|
logg.debug(f"HTTPWriter POST {path} data: {v}, headers: {self.headers}")
|
||||||
rq = urllib.request.Request(path, method="POST", data=v, headers=self.headers)
|
rq = urllib.request.Request(path, method="POST", data=v, headers=self.headers)
|
||||||
r = urllib.request.urlopen(rq)
|
r = urllib.request.urlopen(rq)
|
||||||
logg.info(f"http writer submitted at {r.read()}")
|
logg.info(f"http writer submitted at {r.read()}")
|
||||||
@ -85,13 +85,15 @@ class KeyedWriterFactory:
|
|||||||
logg.debug(f"adding key {k} t keyed writer factory")
|
logg.debug(f"adding key {k} t keyed writer factory")
|
||||||
self.x[k] = v
|
self.x[k] = v
|
||||||
|
|
||||||
def new(self, path=None, *_args, **_kwargs):
|
def new(self, path=None, headers: Dict[str, str] = None, *_args, **_kwargs):
|
||||||
writer_keyed = None
|
writer_keyed = None
|
||||||
writer_immutable = None
|
writer_immutable = None
|
||||||
if self.key_writer_constructor is not None:
|
if self.key_writer_constructor is not None:
|
||||||
writer_keyed = self.key_writer_constructor(path, **self.x)
|
writer_keyed = self.key_writer_constructor(path, **self.x)
|
||||||
if self.immutable_writer_constructor is not None:
|
if self.immutable_writer_constructor is not None:
|
||||||
writer_immutable = self.immutable_writer_constructor(path, **self.x)
|
writer_immutable = self.immutable_writer_constructor(
|
||||||
|
path, headers, **self.x
|
||||||
|
)
|
||||||
return KeyedWriter(writer_keyed, writer_immutable)
|
return KeyedWriter(writer_keyed, writer_immutable)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user