billdeitrick / pypco

A Python client for the Planning Center Online API.
MIT License
39 stars 13 forks source link

Services has no attribute person #8

Closed pastorhudson closed 6 years ago

pastorhudson commented 6 years ago

@billdeitrick I'm stuck. I'm trying to do

for t in pco.services.teams.list(where={'name': team}, include='people'):
    for p in t.rel.people.list():
        print(p.first_name)

And I get

Traceback (most recent call last):
  File "C:/Users/rhudson/PycharmProjects/pcobot/plugins/pco/teams.py", line 37, in <module>
    get('band')
  File "C:/Users/rhudson/PycharmProjects/pcobot/plugins/pco/teams.py", line 13, in get
    for p in t.rel.people.list():
  File "C:\Users\rhudson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pypco\endpoints\base_endpoint.py", line 262, in list_by_url
    klass = getattr(globals()[klass_info[0]], klass_info[1])
AttributeError: module 'pypco.models.services' has no attribute 'Person'

I can't figure out why this doesn't work. Can you point me in the right direction?

pastorhudson commented 6 years ago

I got it working. I had a typo in my models. I didn't fully understand how they worked when I made them, I still don't. Here's what I had to fix