• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-python / 409676

28 May 2025 05:17PM UTC coverage: 67.239% (-0.008%) from 67.247%
409676

push

python-ci

web-flow
Teams SSO and OAuth fixes (#2226)

* Fixed Teams SSO & OAuth

* Formatting

---------

Co-authored-by: Tracy Boehrer <trboehre@microsoft.com>

10 of 21 new or added lines in 8 files covered. (47.62%)

1 existing line in 1 file now uncovered.

9205 of 13690 relevant lines covered (67.24%)

2.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.0
/libraries/botframework-connector/botframework/connector/operations/_attachments_operations.py
1
# coding=utf-8
2
# --------------------------------------------------------------------------
3
# Copyright (c) Microsoft Corporation. All rights reserved.
4
# Licensed under the MIT License. See License.txt in the project root for
5
# license information.
6
# --------------------------------------------------------------------------
7

8
from msrest.pipeline import ClientRawResponse
4✔
9

10
from .. import models
4✔
11

12

13
class AttachmentsOperations:
4✔
14
    """AttachmentsOperations operations.
15

16
    You should not instantiate directly this class, but create a Client instance that will create it for you and attach
17
     it as attribute.
18

19
    :param client: Client for service requests.
20
    :param config: Configuration of service client.
21
    :param serializer: An object model serializer.
22
    :param deserializer: An object model deserializer.
23
    :ivar api_version: The API version to use for the request. Constant value: "v3".
24
    """
25

26
    models = models
4✔
27

28
    def __init__(self, client, config, serializer, deserializer):
4✔
29
        self._client = client
×
30
        self._serialize = serializer
×
31
        self._deserialize = deserializer
×
32

33
        self.config = config
×
34
        self.api_version = "v3"
×
35

36
    def get_attachment_info(
4✔
37
        self, attachment_id, custom_headers=None, raw=False, **operation_config
38
    ):
39
        """GetAttachmentInfo.
40

41
        Get AttachmentInfo structure describing the attachment views.
42

43
        :param attachment_id: attachment id
44
        :type attachment_id: str
45
        :param dict custom_headers: headers that will be added to the request
46
        :param bool raw: returns the direct response alongside the
47
         deserialized response
48
        :param operation_config: :ref:`Operation configuration
49
         overrides<msrest:optionsforoperations>`.
50
        :return: AttachmentInfo or ClientRawResponse if raw=true
51
        :rtype: ~botframework.connector.models.AttachmentInfo or
52
         ~msrest.pipeline.ClientRawResponse
53
        :raises:
54
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
55
        """
56
        # Construct URL
57
        url = self.get_attachment_info.metadata["url"]
×
58
        path_format_arguments = {
×
59
            "attachmentId": self._serialize.url("attachment_id", attachment_id, "str")
60
        }
61
        url = self._client.format_url(url, **path_format_arguments)
×
62

63
        # Construct parameters
64
        query_parameters = {}
×
65

66
        # Construct headers
67
        header_parameters = {}
×
68
        header_parameters["Accept"] = "application/json"
×
69
        if custom_headers:
×
70
            header_parameters.update(custom_headers)
×
71

72
        # Construct and send request
73
        request = self._client.get(url, query_parameters, header_parameters)
×
74
        response = self._client.send(request, stream=False, **operation_config)
×
75

76
        if response.status_code not in [200]:
×
77
            raise models.ErrorResponseException(self._deserialize, response)
×
78

79
        deserialized = None
×
80
        if response.status_code == 200:
×
81
            deserialized = self._deserialize("AttachmentInfo", response)
×
82

83
        if raw:
×
84
            client_raw_response = ClientRawResponse(deserialized, response)
×
85
            return client_raw_response
×
86

87
        return deserialized
×
88

89
    get_attachment_info.metadata = {"url": "/v3/attachments/{attachmentId}"}
4✔
90

91
    def get_attachment(
4✔
92
        self,
93
        attachment_id,
94
        view_id,
95
        custom_headers=None,
96
        raw=False,
97
        callback=None,
98
        **operation_config
99
    ):
100
        """GetAttachment.
101

102
        Get the named view as binary content.
103

104
        :param attachment_id: attachment id
105
        :type attachment_id: str
106
        :param view_id: View id from attachmentInfo
107
        :type view_id: str
108
        :param dict custom_headers: headers that will be added to the request
109
        :param bool raw: returns the direct response alongside the
110
         deserialized response
111
        :param callback: When specified, will be called with each chunk of
112
         data that is streamed. The callback should take two arguments, the
113
         bytes of the current chunk of data and the response object. If the
114
         data is uploading, response will be None.
115
        :type callback: Callable[Bytes, response=None]
116
        :param operation_config: :ref:`Operation configuration
117
         overrides<msrest:optionsforoperations>`.
118
        :return: object or ClientRawResponse if raw=true
119
        :rtype: Generator or ~msrest.pipeline.ClientRawResponse
120
        :raises:
121
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
122
        """
123
        # Construct URL
124
        url = self.get_attachment.metadata["url"]
×
125
        path_format_arguments = {
×
126
            "attachmentId": self._serialize.url("attachment_id", attachment_id, "str"),
127
            "viewId": self._serialize.url("view_id", view_id, "str"),
128
        }
129
        url = self._client.format_url(url, **path_format_arguments)
×
130

131
        # Construct parameters
132
        query_parameters = {}
×
133

134
        # Construct headers
135
        header_parameters = {}
×
136
        header_parameters["Accept"] = "application/json"
×
137
        if custom_headers:
×
138
            header_parameters.update(custom_headers)
×
139

140
        # Construct and send request
141
        request = self._client.get(url, query_parameters, header_parameters)
×
142
        response = self._client.send(request, stream=True, **operation_config)
×
143

144
        if response.status_code not in [200, 301, 302]:
×
145
            raise models.ErrorResponseException(self._deserialize, response)
×
146

147
        deserialized = self._client.stream_download(response, callback)
×
148

149
        if raw:
×
150
            client_raw_response = ClientRawResponse(deserialized, response)
×
151
            return client_raw_response
×
152

153
        return deserialized
×
154

155
    get_attachment.metadata = {"url": "/v3/attachments/{attachmentId}/views/{viewId}"}
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc