mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Update XmlModel.xml_request() to accept also headers argument
This commit is contained in:
parent
f908092f3d
commit
3c096b82c9
@ -756,12 +756,20 @@ class XmlModel(BaseModel):
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def xml_request(cls, method: str, apiurl: str, path: List[str], query: Optional[dict] = None, data: Optional[str] = None) -> urllib3.response.HTTPResponse:
|
def xml_request(
|
||||||
|
cls,
|
||||||
|
method: str,
|
||||||
|
apiurl: str,
|
||||||
|
path: List[str],
|
||||||
|
query: Optional[dict] = None,
|
||||||
|
headers: Optional[str] = None,
|
||||||
|
data: Optional[str] = None,
|
||||||
|
) -> urllib3.response.HTTPResponse:
|
||||||
from ..connection import http_request
|
from ..connection import http_request
|
||||||
from ..core import makeurl
|
from ..core import makeurl
|
||||||
url = makeurl(apiurl, path, query)
|
url = makeurl(apiurl, path, query)
|
||||||
# TODO: catch HTTPError and return the wrapped response as XmlModel instance
|
# TODO: catch HTTPError and return the wrapped response as XmlModel instance
|
||||||
return http_request(method, url, data=data)
|
return http_request(method, url, headers=headers, data=data)
|
||||||
|
|
||||||
def do_update(self, other: "XmlModel") -> None:
|
def do_update(self, other: "XmlModel") -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user