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

Printing a Tagging instance throws AttributeError #21

Open
fishinthecalculator opened this issue May 4, 2024 · 0 comments · May be fixed by #22
Open

Printing a Tagging instance throws AttributeError #21

fishinthecalculator opened this issue May 4, 2024 · 0 comments · May be fixed by #22

Comments

@fishinthecalculator
Copy link

fishinthecalculator commented May 4, 2024

Expected Behavior

I tried printing a pyactionnetwork.models.Tagging instance and I got:

[...]

File ".venv/lib/python3.10/site-packages/pyactionnetwork/models.py", line 89, in __repr__
    return 'Tagging(id={0}, name={1})'.format(self.id, self.name)
AttributeError: 'Tagging' object has no attribute 'name'

It should just print the id probably.

Current Behavior

An AttributeError is thrown

Possible Solution

Line 89 should probably be:

    return 'Tagging(id={0})'.format(self.id)

Steps to Reproduce (for bugs)

Using my branch here https://github.com/fishinthecalculator/pyactionnetwork/tree/issue-21

from pyactionnetwork import ActionNetworkApi
from pyactionnetwork.models import Tagging
from pyactionnetwork.helpers import get_all_resource

an_id = "AN_UUID"
api = ActionNetworkApi("a-secret")
url = f"https://actionnetwork.org/api/v2/people/{an_id}/taggings"
response = get_all_resource("taggings", Tagging, api, url=url)
print(response)

Context

I was just trying to print some Taggings for debugging purposes.

Your Environment

  • Version used (if applicable):

latest available on pypi

  • Operating System and version (desktop or mobile) (if applicable):
poetry --version
Poetry version 1.1.12
poetry run python --version
Python 3.10.7
Linux 6.8.8 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux
  • Link to your project (if applicable):

the code is not public :(

@fishinthecalculator fishinthecalculator linked a pull request May 4, 2024 that will close this issue
7 tasks
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 a pull request may close this issue.

1 participant