bundesAPI / bundesAPI/interpol-api

Example Code does not work

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

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
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
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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing both examples linked in the python-client page and on PyPI with Python 3.10 on Windows. Trace the failures through default_api.py, api_client.py, model_utils.py, red_notices.py, and red_notices_embedded.py, focusing on the reported deserialization errors. Done means both published examples run without either traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.