bundesAPI / interpol-api

interpol red notices api
https://interpol.api.bund.dev
10 stars 3 forks source link

Example Code does not work #8

Open OtenMoten opened 1 year ago

OtenMoten commented 1 year ago

The example code on this page: https://github.com/bundesAPI/interpol-api/tree/main/python-client does not work.

Python Version: 3.10 OS: Windows 10 64-Bit

This is the stacktrace:

Traceback (most recent call last):
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\main.py", line 33, in <module>
    api_response = api_instance.notices_v1_red_get(forename=forename, name=name, nationality=nationality, age_max=age_max, age_min=age_min, free_text=free_text, sex_id=sex_id,
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api\default_api.py", line 263, in notices_v1_red_get
    return self.notices_v1_red_get_endpoint.call_with_http_info(**kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 950, in call_with_http_info
    return self.api_client.call_api(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 432, in call_api
    return self.__call_api(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 236, in __call_api
    return_data = self.deserialize(response_data, response_type, _check_type)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 344, in deserialize
    deserialized_data = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1607, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1468, in attempt_convert_item
    return deserialize_model(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1378, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 358, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model\red_notices.py", line 202, in _from_openapi_data
    setattr(self, var_name, var_value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 179, in __setattr__
    self[attr] = value
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 496, in __setitem__
    self.set_attribute(name, value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 155, in set_attribute
    value = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1607, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1468, in attempt_convert_item
    return deserialize_model(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1378, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 358, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
TypeError: RedNoticesLinks._from_openapi_data() got multiple values for argument '_self'

Process finished with exit code 1

Also, the example code on PyPi.org does not work: https://pypi.org/project/de-interpol

The stacktrace is:

Traceback (most recent call last):
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\main.py", line 36, in <module>
    api_response = api_instance.notices_v1_red_get(forename=forename, name=name, nationality=nationality, age_max=age_max, age_min=age_min, free_text=free_text, sex_id=sex_id,
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api\default_api.py", line 263, in notices_v1_red_get
    return self.notices_v1_red_get_endpoint.call_with_http_info(**kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 950, in call_with_http_info
    return self.api_client.call_api(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 432, in call_api
    return self.__call_api(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 236, in __call_api
    return_data = self.deserialize(response_data, response_type, _check_type)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\api_client.py", line 344, in deserialize
    deserialized_data = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1607, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1481, in attempt_convert_item
    raise conversion_exc
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1468, in attempt_convert_item
    return deserialize_model(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1378, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 358, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model\red_notices.py", line 202, in _from_openapi_data
    setattr(self, var_name, var_value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 179, in __setattr__
    self[attr] = value
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 496, in __setitem__
    self.set_attribute(name, value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 155, in set_attribute
    value = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1607, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1481, in attempt_convert_item
    raise conversion_exc
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1468, in attempt_convert_item
    return deserialize_model(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1378, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 358, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 48, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model\red_notices_embedded.py", line 181, in _from_openapi_data
    setattr(self, var_name, var_value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 179, in __setattr__
    self[attr] = value
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 496, in __setitem__
    self.set_attribute(name, value)
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 155, in set_attribute
    value = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1657, in validate_and_convert_types
    input_value[index] = validate_and_convert_types(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1607, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "C:\Users\Kevin\Documents\PyCharmProjects\bot-hektor-interpol\venv\lib\site-packages\deutschland\interpol\model_utils.py", line 1462, in attempt_convert_item
    raise get_type_error(
deutschland.interpol.exceptions.ApiTypeError: Invalid type for variable '0'. Required value type is str and passed type was dict at ['received_data']['embedded']['notices'][0]

Process finished with exit code 1
OtenMoten commented 1 year ago

This issue is also related to this thread here: https://github.com/bundesAPI/interpol-api/issues/6