bcf
A simple Python implementation of BCF.
Manipulation of BCF-XML is available via bcfxml.py and manipulation of BCF-API
is available via bcfapi.py.
It tries to support BCF-XML version 2.1 and 3.0, and BCF-API 3.0.
bcfxml
The bcfxml.load function lets you read a BCF-XML file.
It takes care of using the right version based on the "bcf.version" file contained in the BCF package.
The BCF files are extracted and parsed on-demand, and edits are stored in memory until you call the save method.
from bcf.bcfxml import load
# Load a project
with load("/path/to/file.bcf") as bcfxml:
project = bcfxml.project
print(project.name)
# To edit a project, just modify the object directly
bcfxml.project.name = "New name"
# Get a dictionary of topics
topics = bcfxml.topics
for topic_guid, topic_handler in bcfxml.topics.items():
topic = topic_handler.topic
print("Topic guid is", topic.guid)
print("Topic title is", topic.title)
# Fetch extra data about a topic
header = topic_handler.header
comments = topic_handler.comments
viewpoints = topic_handler.viewpoints
for comment in comments:
print(comment.guid)
print(comment.comment)
print(comment.author)
# Get a particular topic
topic = bcfxml.get_topic(guid)
# Modify a topic
topic.title = "New title"
bcfxml.save()
bcfapi
The bcfapi module lets you interact with the BCF-API standard.
from bcf.v3.bcfapi import FoundationClient, BcfClient
foundation_client = FoundationClient("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "OPENCDE_BASEURL")
auth_methods = foundation_client.get_auth_methods()
# Our library currently only implements the authorization_code flow
if "authorization_code" in auth_methods:
foundation_client.login()
bcf_client = BcfClient(foundation_client)
versions = foundation_client.get_versions()
for version in versions:
if "3.0" in versions:
if version["api_id"] == "bcf" and version["version_id"] == "3.0":
bcf_client.set_version(version)
data = bcf_client.get_projects()
print(data)
project_id = data[0]["project_id"]
print(project_id)
data = bcf_client.get_project(project_id)
print(data)
data = bcf_client.get_extensions(project_id)
print(data)
Metadata
Release files for bcf-client 0.0.230918
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bcf-client-0.0.230918.tar.gz | 49.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bcf_client-0.0.230918-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 109.7 kB
Release files / bcf-client-0.0.230918.tar.gz
| Download URL | bcf-client-0.0.230918.tar.gz |
|---|---|
| Size | 49.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8442a6858b58c30e8057b5865133238409cdfcea68e7f2d9b6329a4e28937fe9
|
|
BLAKE2b-256 checksum How to use checksums |
66d40a853770f2e0e77e0cdd49a7f176e8e0d4b8e7553849994aebf4ffd63558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / bcf_client-0.0.230918-py3-none-any.whl
| Download URL | bcf_client-0.0.230918-py3-none-any.whl |
|---|---|
| Size | 60.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5879370c149e7a48e6bb288687a5f156b9d7d2671c53f9dcf0a3d371f3a3c83c
|
|
BLAKE2b-256 checksum How to use checksums |
f2eb4b19332f151bce7fbbced2d3e45b29cf75dbbbc50ae6850fcd62ac3b4a7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|