I am trying to parse vCard Objects and i am having issues getting the different types of telephones or addresses i.e home or work. I can only get the first instance but not the second instance of phone.
TEL;TYPE=work,voice;VALUE=uri:tel:+11115551
TEL;TYPE=home,voice;VALUE=uri:tel:+14045551
contact = vobject.readOne(s, allowQP=True)
print contact.tel.type_param
print contact.tel
Both of those work but they only give me the first phone number. I want to do something like below, but of course this gives me an error.
print contact.tel.type_param.home
print contact.tel.work.value
What is the best way to access vCard objects by type?
Vobject is not documented very well. From the method doctring : """Return a child's value (the first, by default), or None."""
So to fix it, i had to specify a childnumber other than Zero.
print contact.getChildValue('tel',default = None, childNumber = 0)
print contact.getChildValue('tel',default = None, childNumber = 1)