Extension Version#
- class ocdsextensionregistry.extension_version.ExtensionVersion(data, file_urls=None)[source]#
- __init__(data, file_urls=None)[source]#
Accepts a row from extension_versions.csv and assigns values to properties.
- remote(basename, default=None)[source]#
Returns the contents of the file within the extension. If the
default
is set and the file does not exist, returns the provideddefault
value.If the extension has a download URL, caches all the files’ contents. Otherwise, downloads and caches the requested file’s contents. Raises an HTTPError if a download fails.
- Raises:
DoesNotExist – if the file isn’t in the extension
zipfile.BadZipFile – if the download URL is not a ZIP file
- property files#
Returns the unparsed contents of all files. Decodes the contents of CSV, JSON and Markdown files.
If the extension has a download URL, caches all the files’ contents. Otherwise, returns an empty dict. Raises an HTTPError if the download fails.
- Raises:
zipfile.BadZipFile – if the download URL is not a ZIP file
- zipfile()[source]#
If the extension has a download URL, downloads and returns the ZIP archive.
- Raises:
NotAvailableInBulk – if the extension has no download URL
zipfile.BadZipFile – if the download URL is not a ZIP file
- property metadata#
Retrieves and returns the parsed contents of the extension’s extension.json file.
Adds language maps if not present.
- property schemas#
Retrieves and returns the parsed contents of the extension’s schemas files.
- property codelists#
Retrieves and returns the parsed contents of the extension’s codelists files.
If the extension has no download URL, and if no codelists are listed in extension.json, returns an empty dict.
- property repository_full_name#
Returns the full name of the extension’s repository, which should be a unique identifier on the hosting service, e.g. open-contracting-extensions/ocds_bid_extension
Experimental
- property repository_name#
Returns the short name of the extension’s repository, i.e. omitting any organizational prefix, which can be used to create directories, e.g. ocds_bid_extension
Experimental
- property repository_user#
Returns the user or organization to which the extension’s repository belongs, e.g. open-contracting-extensions
Experimental
- property repository_user_page#
Returns the URL to the landing page of the user or organization to which the extension’s repository belongs, e.g. https://github.com/open-contracting-extensions
Experimental
- property repository_html_page#
Returns the URL to the landing page of the extension’s repository, e.g. https://github.com/open-contracting-extensions/ocds_bid_extension
Experimental
- property repository_url#
Returns the URL of the extension’s repository, in a format that can be input to a VCS program without modification, e.g. https://github.com/open-contracting-extensions/ocds_bid_extension.git
Experimental