Creating a multiple URL vCard using vObject

1.6k views Asked by At

How can I get multiple URL in one VCard.

I am using VObject library (https://pypi.org/project/vobject/)

I want to create a VCard with details like:

  • Fname
  • Lname
  • Company name
  • Phone number
  • address
  • website url
  • facebook url
  • insta gram url
  • Tik tok url
  • twitter url

I tried the following code

    vCard.add('URL')
    vCard.url.value = 'https://www.example.com'
    vCard.url.type_param = "Website:"

    vCard.add('URL')
    vCard.url.value = 'https://www.facebook.com'
    vCard.url.type_param = "Facebook:"

In the output I was only able to get one of the link:

BEGIN:VCARD
VERSION:3.0
EMAIL;TYPE=INTERNET:[email protected]
FN:Justin
N:White;Justin;;;
ORG:Tesla
TEL;TYPE=HOME:+16503977339
URL;TYPE=Facebook:https://www.facebook.com
URL:
END:VCARD
1

There are 1 answers

1
Abdul Wajid On

You can do something like this

v = vobject.vCard()
o = v.add('url')
o.type_param = "WEBSITE"
o.value = "website_link"

o = v.add('url')
o.type_param = "TWITTER"
o.value = "twitter_link"