Skip to content

Commit e350a1b

Browse files
authored
removing the converting url string to URL (#41435)
* removing the converting url string to URL * fixing the live test * fxing reference error
1 parent 8c322c5 commit e350a1b

File tree

11 files changed

+1
-249
lines changed
  • sdk/communication
    • azure-communication-callautomation
    • azure-communication-chat/azure/communication/chat/_shared
    • azure-communication-email/azure/communication/email/_shared
    • azure-communication-identity/azure/communication/identity/_shared
    • azure-communication-jobrouter/azure/communication/jobrouter/_shared
    • azure-communication-messages/azure/communication/messages/_shared
    • azure-communication-phonenumbers/azure/communication/phonenumbers/_shared
    • azure-communication-rooms/azure/communication/rooms/_shared
    • azure-communication-sms/azure/communication/sms/_shared

11 files changed

+1
-249
lines changed

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-callautomation/tests/test_call_media_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
HoldRequest,
3131
UnholdRequest,
3232
StartMediaStreamingRequest,
33-
StopMediaStreamingRequest,
34-
InterruptAudioAndAnnounceRequest
33+
StopMediaStreamingRequest
3534
)
3635
from azure.communication.callautomation._generated.models._enums import RecognizeInputType, DtmfTone
3736
from unittest.mock import Mock

sdk/communication/azure-communication-callautomation/tests/test_e2e_media_client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
PhoneNumberIdentifier,
1616
MediaStreamingOptions,
1717
MediaStreamingContentType,
18-
MediaStreamingTransportType,
1918
MediaStreamingAudioChannelType,
2019
TranscriptionOptions,
21-
TranscriptionTransportType,
2220
TextSource,
2321
RecognizeInputType,
2422
RecognitionChoice
@@ -215,7 +213,6 @@ def test_start_stop_media_streaming_in_a_call(self):
215213

216214
media_streaming_options=MediaStreamingOptions(
217215
transport_url=self.transport_url,
218-
transport_type=MediaStreamingTransportType.WEBSOCKET,
219216
content_type=MediaStreamingContentType.AUDIO,
220217
audio_channel_type=MediaStreamingAudioChannelType.MIXED,
221218
start_media_streaming=False)
@@ -277,7 +274,6 @@ def test_start_stop_transcription_in_call(self):
277274

278275
transcription_options=TranscriptionOptions(
279276
transport_url=self.transport_url,
280-
transport_type=TranscriptionTransportType.WEBSOCKET,
281277
locale="en-US",
282278
start_transcription=False)
283279

sdk/communication/azure-communication-chat/azure/communication/chat/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-email/azure/communication/email/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-identity/azure/communication/identity/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-messages/azure/communication/messages/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

sdk/communication/azure-communication-rooms/azure/communication/rooms/_shared/policy.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def _sign_request(self, request):
6363
if parsed_url.query:
6464
query_url += "?" + parsed_url.query
6565

66-
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
67-
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
68-
try:
69-
from yarl import URL
70-
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
71-
AioHttpTransport,
72-
)
73-
74-
if (
75-
isinstance(request.context.transport, AioHttpTransport)
76-
or isinstance(
77-
getattr(request.context.transport, "_transport", None),
78-
AioHttpTransport,
79-
)
80-
or isinstance(
81-
getattr(
82-
getattr(request.context.transport, "_transport", None),
83-
"_transport",
84-
None,
85-
),
86-
AioHttpTransport,
87-
)
88-
):
89-
query_url = str(URL(query_url))
90-
except (ImportError, TypeError):
91-
pass
92-
9366
if self._decode_url:
9467
query_url = urllib.parse.unquote(query_url)
9568

0 commit comments

Comments
 (0)