How to use the msrest.Configuration function in msrest

To help you get started, we’ve selected a few msrest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / msrest-for-python / tests / test_runtime.py View on Github external
def setUp(self):

        cfg = Configuration("https://my_service.com")
        cfg.retry_policy.backoff_factor=0
        cfg.redirect_policy.max_redirects=2
        cfg.credentials = Authentication()

        self.client = ServiceClient(None, cfg)

        return super(TestRedirect, self).setUp()
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / Url / auto_rest_url_test_service / auto_rest_url_test_service.py View on Github external
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.paths_operations import PathsOperations
from .operations.queries_operations import QueriesOperations
from .operations.path_items_operations import PathItemsOperations
from . import models


class AutoRestUrlTestServiceConfiguration(Configuration):
    """Configuration for AutoRestUrlTestService
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param global_string_path: A string value 'globalItemStringPath' that
     appears in the path
    :type global_string_path: str
    :param global_string_query: should contain value null
    :type global_string_query: str
    :param str base_url: Service URL
    """

    def __init__(
            self, global_string_path, global_string_query=None, base_url=None):

        if global_string_path is None:
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / Url / autoresturltestservice / auto_rest_url_test_service.py View on Github external
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.paths_operations import PathsOperations
from .operations.queries_operations import QueriesOperations
from .operations.path_items_operations import PathItemsOperations
from . import models


class AutoRestUrlTestServiceConfiguration(Configuration):
    """Configuration for AutoRestUrlTestService
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param global_string_path: A string value 'globalItemStringPath' that
     appears in the path
    :type global_string_path: str
    :param global_string_query: should contain value null
    :type global_string_query: str
    :param str base_url: Service URL
    """

    def __init__(
            self, global_string_path, global_string_query=None, base_url=None):

        if global_string_path is None:
github Azure / msrest-for-python / tests / test_client.py View on Github external
def test_context_manager(self):

        cfg = Configuration("http://127.0.0.1/")

        class Creds(Authentication):
            def __init__(self):
                self.first_session = None
                self.called = 0

            def signed_session(self, session=None):
                self.called += 1
                assert session is not None
                if self.first_session:
                    assert self.first_session is session
                else:
                    self.first_session = session
        cfg.credentials = Creds()

        with ServiceClient(None, cfg) as client:
github Azure / msrest-for-python / tests / test_client.py View on Github external
def test_client_request(self):

        cfg = Configuration("http://127.0.0.1/")
        client = ServiceClient(self.creds, cfg)
        obj = client.get('/')
        self.assertEqual(obj.method, 'GET')
        self.assertEqual(obj.url, "http://127.0.0.1/")

        obj = client.get("/service", {'param':"testing"})
        self.assertEqual(obj.method, 'GET')
        self.assertEqual(obj.url, "http://127.0.0.1/service?param=testing")

        obj = client.get("service 2")
        self.assertEqual(obj.method, 'GET')
        self.assertEqual(obj.url, "http://127.0.0.1/service 2")

        cfg.base_url = "https://127.0.0.1/"
        obj = client.get("//service3")
        self.assertEqual(obj.method, 'GET')
github Azure / azure-sdk-for-java / AutoRest / Generators / Python / Python.Tests / Expected / AcceptanceTests / BodyBoolean / autorestbooltestservice / auto_rest_bool_test_service.py View on Github external
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.bool_model import BoolModel
from . import models


class AutoRestBoolTestServiceConfiguration(Configuration):
    """Configuration for AutoRestBoolTestService
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param str base_url: Service URL
    :param str filepath: Existing config
    """

    def __init__(
            self, base_url=None, filepath=None):

        if not base_url:
            base_url = 'http://localhost'

        super(AutoRestBoolTestServiceConfiguration, self).__init__(base_url, filepath)
github Azure / azure-sdk-for-python / sdk / applicationinsights / azure-applicationinsights / azure / applicationinsights / application_insights_data_client.py View on Github external
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.metrics_operations import MetricsOperations
from .operations.events_operations import EventsOperations
from .operations.query_operations import QueryOperations
from . import models


class ApplicationInsightsDataClientConfiguration(Configuration):
    """Configuration for ApplicationInsightsDataClient
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param credentials: Subscription credentials which uniquely identify
     client subscription.
    :type credentials: None
    :param str base_url: Service URL
    """

    def __init__(
            self, credentials, base_url=None):

        if credentials is None:
            raise ValueError("Parameter 'credentials' must not be None.")
        if not base_url:
github Azure / azure-sdk-for-python / sdk / cognitiveservices / azure-cognitiveservices-language-spellcheck / azure / cognitiveservices / language / spellcheck / spell_check_api.py View on Github external
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from . import models


class SpellCheckAPIConfiguration(Configuration):
    """Configuration for SpellCheckAPI
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param credentials: Subscription credentials which uniquely identify
     client subscription.
    :type credentials: None
    :param str base_url: Service URL
    """

    def __init__(
            self, credentials, base_url=None):

        if credentials is None:
            raise ValueError("Parameter 'credentials' must not be None.")
        if not base_url:
github Azure / autorest / src / generator / AutoRest.Python.Tests / Expected / AcceptanceTests / BodyArray / auto_rest_swagger_bat_array_service / auto_rest_swagger_bat_array_service.py View on Github external
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.array_operations import ArrayOperations
from . import models


class AutoRestSwaggerBATArrayServiceConfiguration(Configuration):
    """Configuration for AutoRestSwaggerBATArrayService
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param str base_url: Service URL
    """

    def __init__(
            self, base_url=None):

        if not base_url:
            base_url = 'http://localhost'

        super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(base_url)

        self.add_user_agent('autorestswaggerbatarrayservice/{}'.format(VERSION))
github microsoft / vsts-cd-manager / vsts_accounts / account.py View on Github external
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from __future__ import print_function
from sys import stderr
from msrest.service_client import ServiceClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrest.exceptions import HttpOperationError
from . import models
from .models import AccountModel


class AccountConfiguration(Configuration):
    """Configuration for Account
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param api_version: Version of the API to use.  This should be set to
     '3.2-preview' to use this version of the api.
    :type api_version: str
    :param str base_url: Service URL
    """

    def __init__(
            self, api_version, base_url=None):

        if api_version is None:
            raise ValueError("Parameter 'api_version' must not be None.")
        if not isinstance(api_version, str):