Skip to content

body in APIError is never assigned #948

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

Closed
1 task done
cenhao opened this issue Dec 7, 2023 · 1 comment · Fixed by #949
Closed
1 task done

body in APIError is never assigned #948

cenhao opened this issue Dec 7, 2023 · 1 comment · Fixed by #949
Labels
bug Something isn't working

Comments

@cenhao
Copy link
Contributor

cenhao commented Dec 7, 2023

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

In the APIError class, there is a body class variable. Based on the comment:

    ""The API response body.

    If the API responded with a valid JSON structure then this property will be the
    decoded result.

    If it isn't a valid JSON structure then this will be the raw response.

    If there was no response associated with this error then it will be `None`.
    """

This class variable should contain the body of the response. However in the __init__ function, the body variable is not assigned and kept.

To Reproduce

Simply error.body will result in:

AttributeError: 'XxxxxxError' object has no attribute 'body'

Code snippets

No response

OS

OS agnostic

Python version

Python version agnostic

Library version

Lib version agnostic

@cenhao cenhao added the bug Something isn't working label Dec 7, 2023
@cenhao
Copy link
Contributor Author

cenhao commented Dec 7, 2023

Also created a PR for this: #949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants