Skip to main content

Phonexia microservice communication via grpc library

This library contains defined interfaces for all microservices developed by Phonexia.

To use this library you will first need a running instance of any Phonexia microservice. If you don't yet have any running instance, don't hesitate to contact our sales department.

On this page, you may find a gRPC API reference for all microservices.

Example

Examples require microservice running on local machine at port 8080.

Health check

You can invoke health check method of any microservice like this:

import grpc

from phonexia.grpc.common.health_check_pb2 import HealthCheckRequest
from phonexia.grpc.common.health_check_pb2_grpc import HealthStub


def health_check(stub: HealthStub):
    """Create request and call the service.
    Invoke Info method of the health stub.
    Args:
        stub (LicensingStub): Created stub for communication with service.
    """
    request = HealthCheckRequest()
    response = stub.Check(request)
    print(response)


def main():
    """Create a gRPC channel and connect to the service."""
    with grpc.insecure_channel(target="localhost:8080") as channel:
        """Create channel to the service.
        The target parameter is the service address and port.
        insecure channel is used for connection without TLS.
        To use SSl/TLS see the grpc_secure_channel function.
        """
        stub = HealthStub(channel)
        health_check(stub)


if __name__ == "__main__":
    main()

If the microservice is running, it should return: status: SERVING.

Check license

Each microservice has licensed model which is required to run the service. You can fetch information about licensed models like this:

import grpc

from phonexia.grpc.common.licensing_pb2 import LicensingInfoRequest
from phonexia.grpc.common.licensing_pb2_grpc import LicensingStub


def licensing_check(stub: LicensingStub):
    """Create request and call the service.
    Invoke Info method of the Licensing stub.
    Args:
        stub (LicensingStub): Created stub for communication with service.
    """
    request = LicensingInfoRequest()
    response = stub.Info(request)
    print(
        f"The license for technology '{response.technology_name}' with model"
        f" '{response.model_info.name}:{response.model_info.version}'"
        f" {'is' if response.is_valid else 'was'} valid until {response.valid_until}."
    )


def main():
    """Create a gRPC channel and connect to the service."""
    with grpc.insecure_channel(target="localhost:8080") as channel:
        """Create channel to the service.
        The target parameter is the service address and port.
        insecure channel is used for connection without TLS.
        To use SSl/TLS see the grpc_secure_channel function.
        """
        stub = LicensingStub(channel=channel)
        licensing_check(stub)


if __name__ == "__main__":
    main()

Returned message should contain information about technology name, model name with version and time validity of license.

Release files for phonexia-grpc 1.4.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 phonexia-grpc 1.4.0
File Size Uploaded
phonexia_grpc-1.4.0.tar.gz 16.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phonexia-grpc 1.4.0
File Interpreter ABI Platform
phonexia_grpc-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.4 kB

Release files / phonexia_grpc-1.4.0.tar.gz

Download URL phonexia_grpc-1.4.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c755120a1fbe7ac1a34f6e92f579b8035640e85c181a2ba34300d3d677dc4a78
BLAKE2b-256 checksum
How to use checksums
21332c8f5673466c5ad3b291f3633a455c7d5e1a9d0e6c77a02d8071827998c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Linux/5.14.0-362.8.1.el9_3.x86_64

Release files / phonexia_grpc-1.4.0-py3-none-any.whl

Download URL phonexia_grpc-1.4.0-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec337726400347d97c2580011004b3a5b6b6ce740ed586efefe945ac3cb49b65
BLAKE2b-256 checksum
How to use checksums
e8ccff835118adcdc56aba6c0f1fdfe2d12b2c4cf2ee00738e8da7d008c9c910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Linux/5.14.0-362.8.1.el9_3.x86_64

Release history Release notifications | RSS feed

2.31.2

1 release file

2.31.1

1 release file

2.31.0

2 release files

2.30.0

2 release files

2.28.0

2 release files

2.27.1

2 release files

2.26.0

2 release files

2.25.0

2 release files

2.24.0

2 release files

2.21.0

2 release files

2.20.0

2 release files

2.18.0

2 release files

2.16.2

2 release files

2.16.1

2 release files

2.16.0

2 release files

2.12.1

2 release files

2.12.0

2 release files

2.11.0

2 release files

2.10.0

2 release files

2.9.0

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.5.0

2 release files

This release

1.4.0 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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