Skip to main content

vcap_service_python

Build Status Coverage Status

Parse and return service credentials from environment variables that IBM Cloud provides.

Installation

$ pip install vcap_services

Usage

from vcap_services import load_from_vcap_services
credentials = load_from_vcap_services('personality_insights')
print(credentials);

If VCAP_SERVICES is:

{
  "personality_insights": [{
      "credentials": {
        "password": "<password>",
        "url": "<url>",
        "username": "<username>"
      },
    "label": "personality_insights",
    "name": "personality-insights-service",
    "plan": "standard"
  }]
}

Output:

{
  "password": "<password>",
  "url": "<url>",
  "username": "<username>"
}

Getting credentials for a specific plan

Get credentials that match a specific service plan (only for VCAP_SERVICES).

from vcap_services import load_from_vcap_services
credentials = load_from_vcap_services('personality_insights', 'standard')
print(credentials);

Getting credentials for a specific instance

Get credentials that match a specific service instance (replace “YOUR NLC NAME” with the name of your service instance).

from vcap_services import load_from_vcap_services
credentials = load_from_vcap_services('natural_language_classifier', None, 'YOUR NLC NAME')
print(credentials);

Getting credentials for a specific plan and instance

Get credentials that match a specific service plan and instance (replace “YOUR NLC NAME” with the name of your service instance).

from vcap_services import load_from_vcap_services
credentials = load_from_vcap_services('natural_language_classifier', 'standard', 'YOUR NLC NAME')
print(credentials);

Tests

Running all the tests:

$ pip install -r requirements.txt
$ cp .env.mock .env
$ pytest --cov=vcap_services

License

MIT.

Contributing

See CONTRIBUTING.

Metadata

Release files for vcap-services 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcap-services 1.0.0
File Size Uploaded Provenance Actions
vcap_services-1.0.0.tar.gz 4.2 kB Without provenance Details for vcap_services-1.0.0.tar.gz

Release files / vcap_services-1.0.0.tar.gz

Download URL vcap_services-1.0.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1b856576ce0290c717022e0b76d5e5d448cd1bee94985affcca22cde6a11905e
BLAKE2b-256 checksum
How to use checksums
364134f21399a1100de41a3e8763160efe3ecda51c5a8fefedbe60ba29d596fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.14

Security for vcap-services 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page