Skip to content

Printing a Tagging instance throws AttributeError #21

@fishinthecalculator

Description

@fishinthecalculator

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 :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions