File: client_configuration_sample.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (25 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from azure.iot.modelsrepository import ModelsRepositoryClient
from azure.core.pipeline.transport import RequestsTransport
from azure.core.pipeline.policies import UserAgentPolicy, RetryPolicy


def default_client():
    # By default, this client will be configured for the Azure Device Models Repository
    # i.e. https://devicemodels.azure.com/
    client = ModelsRepositoryClient()


def use_remote_repository():
    # You can specify a custom remote endpoint where your Models Repository is located
    client = ModelsRepositoryClient(repository_location="https://fake.myrepository.com/")


def use_local_repository():
    # You can also specify a custom local filesystem path where your Models Repository is located.
    # Paths can be specified as relative or absolute, as well as in URI format
    client = ModelsRepositoryClient(repository_location="file:///home/fake/myrepository")