Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix datatype for Course endYear attribute #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bkeifer
Copy link

@bkeifer bkeifer commented Sep 27, 2024

get_courses() fails because it is expecting endYear to be an str instead of an int:

Traceback (most recent call last):
  File "/Users/brian/code/icapi/icapi/./course.py", line 168, in <module>
    printCourses()
  File "/Users/brian/code/icapi/icapi/./course.py", line 68, in printCourses
    courses = asyncio.run(get_courses())
  File "/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/Users/brian/code/icapi/icapi/./course.py", line 35, in get_courses
    return await client.courses(1499)
  File "/Users/brian/Library/Caches/pypoetry/virtualenvs/icapi-x1CbIzMR-py3.10/lib/python3.10/site-packages/ic_parent_api/infinitecampus.py", line 43, in courses
    coursesresp = await self._api_client.get_courses(student_id)
  File "/Users/brian/Library/Caches/pypoetry/virtualenvs/icapi-x1CbIzMR-py3.10/lib/python3.10/site-packages/ic_parent_api/ic_api_client.py", line 95, in get_courses
    return [CourseResponse(**resp) for resp in parsed_response]
  File "/Users/brian/Library/Caches/pypoetry/virtualenvs/icapi-x1CbIzMR-py3.10/lib/python3.10/site-packages/ic_parent_api/ic_api_client.py", line 95, in <listcomp>
    return [CourseResponse(**resp) for resp in parsed_response]
  File "/Users/brian/Library/Caches/pypoetry/virtualenvs/icapi-x1CbIzMR-py3.10/lib/python3.10/site-packages/pydantic/main.py", line 209, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for CourseResponse
endYear
  Input should be a valid string [type=string_type, input_value=2025, input_type=int]
    For further information visit https://errors.pydantic.dev/2.9/v/string_type```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant