RFC 6350-compliant vCard 4.0 parser & generator
Project description
pythonvCard4
A RFC 6350‑compliant vCard 4.0 parser and generator for Python.
Features
- Create vCard (.vcf) files from Python
Contactobjects - Parse existing vCard files back into
Contactinstances - Support for names, emails, multiple phone numbers, addresses, URLs, social profiles, photos, dates, and more
- Inline image embedding (resize + Base64 encode)
- Extension properties (
X-fields) viacustomandsocial_profiles - Full round‑trip fidelity, folding/unfolding, and escaping per spec
Installation
Install via PyPI:
pip install pythonvCard4
Quick Start
1. Create a vCard
from datetime import date
from pythonvCard4.vcard import Contact
# Build a Contact
c = Contact(
fn="Jane Doe",
n=["Doe","Jane","","",""] ,
email=[{"value": "jane@example.com", "type": ["work"]}],
tel=[
{"value": "+1234567890", "type": ["cell"]},
{"value": "+0987654321", "type": ["home"]}
],
url=["https://janedoe.dev"],
bday=date(1990, 5, 15),
)
# Add a Twitter profile
c.social_profiles.append({
"type": ["twitter"],
"value": "http://twitter.com/janedoe"
})
# Embed a photo (JPEG)
c.photo_path = "path/to/photo.jpg"
# Serialize to vCard text
vcf_text = c.to_vcard()
print(vcf_text)
2. Parse an existing vCard
from pythonvCard4.vcard import Contact
# Load from file
vcf_text = open('jane.vcf', 'r', encoding='utf-8').read()
contact = Contact.from_vcard(vcf_text)
print(contact.fn)
print(contact.tel)
print(contact.social_profiles)
Documentation & Support
See [GitHub](https://github.com/sharf-shawon/pythonvCard4 for full docs, examples, and issue tracking.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pythonvcard4-0.2.0.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythonvcard4-0.2.0.tar.gz.
File metadata
- Download URL: pythonvcard4-0.2.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236bba2769e459645cfa776407ff07856aced45b437116bf40ddb39bbcefdb6d
|
|
| MD5 |
8c63771c63b6b0557a9a5ccf14f56963
|
|
| BLAKE2b-256 |
340402d5952a9d8cbcb9e62b4fc4f6f842e8d43aead6e307f83e6fd6f7352fbd
|
File details
Details for the file pythonvcard4-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pythonvcard4-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dce31355dd50aee537f8883de86f301510e407bc1755a68ec8d5055b64f5c660
|
|
| MD5 |
a5c38e27a7a85e649f54953ee955afb6
|
|
| BLAKE2b-256 |
0d2fee10d88bbe12e4e9e06f81589d999687038e5cd5fec6c05aed57c50aede6
|