You want a type union. For Python 3.10+:
def post_xml(data: str | ET.Element):
For earlier versions:
from typing import Union
def post_xml(data: Union[str, ET.Element]):
...
You want a type union. For Python 3.10+:
def post_xml(data: str | ET.Element):
For earlier versions:
from typing import Union
def post_xml(data: Union[str, ET.Element]):
...