Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communication] - Phone Numbers - Changed User-Agent in request #17162

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

VERSION = "1.0.0b4"

SDK_MONIKER = "communication-administration/{}".format(VERSION) # type: str
SDK_MONIKER = "communication-phonenumbers/{}".format(VERSION) # type: str
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def process_response(self, response):
if isinstance(item, str):
body["phoneNumbers"] = [self._replacement]
break
elif "phoneNumber" in item:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we change from elif to if here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to sanitize both values. Having an elif only sanitized the phone number or the id, but not both at the same time.

if "phoneNumber" in item:
item['phoneNumber'] = self._replacement
elif "id" in item:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we change from elif to if here?

if "id" in item:
item['id'] = self._replacement
response['body']['string'] = json.dumps(body)
response['url'] = self._replacement
return response
except (KeyError, ValueError):
except (KeyError, ValueError, TypeError):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need this change for the User-agent change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for the type error issue we have in the search available phone numbers test. We weren't catching that exception before. It's totally unrelated to the user agent issue, though.

return response

class BodyReplacerProcessor(RecordingProcessor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ interactions:
Connection:
- keep-alive
Date:
- Fri, 05 Mar 2021 22:19:58 GMT
- Mon, 08 Mar 2021 17:41:35 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand All @@ -26,15 +26,15 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 05 Mar 2021 22:20:00 GMT
- Mon, 08 Mar 2021 17:41:36 GMT
ms-cv:
- aa2xk97xc06kIOakrLVlZQ.0
- gk4Y2l2T2UO9cLNf+5ptrw.0
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 1617ms
- 1829ms
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,60 @@ interactions:
Connection:
- keep-alive
Date:
- Fri, 05 Mar 2021 22:20:00 GMT
- Mon, 08 Mar 2021 17:41:37 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07
response:
body:
string: '{"phoneNumbers": [{"id": "16194895581", "phoneNumber": "sanitized",
"countryCode": "US", "phoneNumberType": "Geographic", "capabilities": {"calling":
"outbound", "sms": "none"}, "assignmentType": "Person", "purchaseDate": "2021-01-13T20:01:52.0795301+00:00",
string: '{"phoneNumbers": [{"id": "sanitized", "phoneNumber": "sanitized", "countryCode":
"US", "phoneNumberType": "Geographic", "capabilities": {"calling": "outbound",
"sms": "none"}, "assignmentType": "Person", "purchaseDate": "2021-01-13T20:01:52.0795301+00:00",
"cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "16194895593", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"Geographic", "capabilities": {"calling": "outbound", "sms": "none"}, "assignmentType":
"Person", "purchaseDate": "2021-01-13T20:57:24.5482566+00:00", "cost": {"amount":
1.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id": "18332143261",
1.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id": "sanitized",
"phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType": "TollFree",
"capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, "assignmentType":
"Application", "purchaseDate": "2020-11-30T17:51:21.2991518+00:00", "cost":
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id":
"18443281555", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2020-11-12T21:53:12.2088187+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "18445492606", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-03-04T19:24:10.3004481+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-03-05T22:24:46.5160739+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-03-05T22:30:37.0532427+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-03-05T22:27:26.3166637+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}]}'
headers:
content-type:
- application/json; charset=utf-8
date:
- Fri, 05 Mar 2021 22:20:04 GMT
- Mon, 08 Mar 2021 17:41:46 GMT
ms-cv:
- PcsdnL23aEGt6Y89OREU2w.0
- zv0HSHVuUUi1JsCXB5qJ2w.0
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 3504ms
- 9259ms
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,41 @@ interactions:
Connection:
- keep-alive
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07
response:
body:
string: '{"phoneNumbers": [{"id": "18332272412", "phoneNumber": "sanitized",
string: '{"phoneNumbers": [{"id": "sanitized", "phoneNumber": "sanitized",
"countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling":
"inbound", "sms": "inbound+outbound"}, "assignmentType": "Application", "purchaseDate":
"2021-02-09T23:00:10.4372681+00:00", "cost": {"amount": 2.0, "currencyCode":
"USD", "billingFrequency": "Monthly"}}, {"id": "18332272430", "phoneNumber":
"USD", "billingFrequency": "Monthly"}}, {"id": "sanitized", "phoneNumber":
"sanitized", "countryCode": "US", "phoneNumberType": "TollFree", "capabilities":
{"calling": "inbound", "sms": "inbound+outbound"}, "assignmentType": "Application",
"purchaseDate": "2021-02-09T22:58:41.2504122+00:00", "cost": {"amount": 2.0,
"currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id": "18332272445",
"currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id": "sanitized",
"phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType": "TollFree",
"capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, "assignmentType":
"Application", "purchaseDate": "2021-02-09T23:03:57.6969271+00:00", "cost":
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, {"id":
"18332321209", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-02-10T17:51:13.4876763+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "18332321221", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-02-10T17:52:41.818335+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "18332321226", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2021-02-10T18:01:46.4199999+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "18335260208", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
"assignmentType": "Application", "purchaseDate": "2000-01-01T00:00:00+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}},
{"id": "18336369501", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
"TollFree", "capabilities": {"calling": "inbound+outbound", "sms": "none"},
"assignmentType": "Application", "purchaseDate": "2020-09-18T15:03:19.5370985+00:00",
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}]}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:37:27 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: POST
Expand Down Expand Up @@ -58,7 +58,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:38:00 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand Down Expand Up @@ -99,7 +99,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:38:01 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand Down Expand Up @@ -144,7 +144,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:38:02 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: POST
Expand Down Expand Up @@ -186,7 +186,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:38:34 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand Down Expand Up @@ -227,7 +227,7 @@ interactions:
Date:
- Fri, 05 Mar 2021 22:38:34 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: DELETE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ interactions:
Content-Type:
- application/merge-patch+json
Date:
- Fri, 05 Mar 2021 22:20:43 GMT
- Mon, 08 Mar 2021 17:41:48 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: PATCH
uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized/capabilities?api-version=2021-03-07
response:
body:
string: '{"capabilitiesUpdateId": "a8589969-1d09-4ad3-9b5a-39ce067ea535"}'
string: '{"capabilitiesUpdateId": "5aa2069a-dd2b-4348-9f16-314acb37d2f6"}'
headers:
access-control-expose-headers:
- Operation-Location,Location,operation-id,capabilities-id
capabilities-id:
- a8589969-1d09-4ad3-9b5a-39ce067ea535
- 5aa2069a-dd2b-4348-9f16-314acb37d2f6
content-type:
- application/json; charset=utf-8
date:
- Fri, 05 Mar 2021 22:20:44 GMT
- Mon, 08 Mar 2021 17:41:49 GMT
ms-cv:
- KjGZkSHB5kCrsxscH9ibgQ.0
- pNZwMhI3IUiVz657e2a3DQ.0
operation-id:
- capabilities_a8589969-1d09-4ad3-9b5a-39ce067ea535
- capabilities_5aa2069a-dd2b-4348-9f16-314acb37d2f6
operation-location:
- /phoneNumbers/operations/capabilities_a8589969-1d09-4ad3-9b5a-39ce067ea535?api-version=2021-03-07
- /phoneNumbers/operations/capabilities_5aa2069a-dd2b-4348-9f16-314acb37d2f6?api-version=2021-03-07
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 987ms
- 943ms
status:
code: 202
message: Accepted
Expand All @@ -58,33 +58,33 @@ interactions:
Connection:
- keep-alive
Date:
- Fri, 05 Mar 2021 22:21:14 GMT
- Mon, 08 Mar 2021 17:42:20 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
uri: https://sanitized.communication.azure.com/phoneNumbers/operations/capabilities_a8589969-1d09-4ad3-9b5a-39ce067ea535?api-version=2021-03-07
uri: https://sanitized.communication.azure.com/phoneNumbers/operations/capabilities_5aa2069a-dd2b-4348-9f16-314acb37d2f6?api-version=2021-03-07
response:
body:
string: '{"status": "Succeeded", "resourceLocation": "/phoneNumbers/+18332143261?api-version=2021-03-07",
"createdDateTime": "2021-03-05T22:20:44.5342481+00:00", "id": "sanitized",
"createdDateTime": "2021-03-08T17:41:49.3163011+00:00", "id": "sanitized",
"operationType": "UpdatePhoneNumberCapabilities", "lastActionDateTime": "0001-01-01T00:00:00+00:00"}'
headers:
access-control-expose-headers:
- Location
content-type:
- application/json; charset=utf-8
date:
- Fri, 05 Mar 2021 22:21:14 GMT
- Mon, 08 Mar 2021 17:42:19 GMT
ms-cv:
- I5gz/NLH7kWVu9cfp44HpQ.0
- RSJdlEmKe0O0AkxOkYF91g.0
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 254ms
- 253ms
status:
code: 200
message: OK
Expand All @@ -99,9 +99,9 @@ interactions:
Connection:
- keep-alive
Date:
- Fri, 05 Mar 2021 22:21:14 GMT
- Mon, 08 Mar 2021 17:42:20 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand All @@ -116,15 +116,15 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 05 Mar 2021 22:21:15 GMT
- Mon, 08 Mar 2021 17:42:20 GMT
ms-cv:
- VbgvUURuDkyiQ4llLoXMPA.0
- R7OdWLUtxE2LScLoCsO/MQ.0
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 1201ms
- 1145ms
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ interactions:
Accept:
- application/json
Date:
- Fri, 05 Mar 2021 22:21:16 GMT
- Mon, 08 Mar 2021 17:42:21 GMT
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
- azsdk-python-communication-phonenumbers/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-return-client-request-id:
- 'true'
method: GET
Expand All @@ -20,11 +20,11 @@ interactions:
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}'
headers:
content-type: application/json; charset=utf-8
date: Fri, 05 Mar 2021 22:21:18 GMT
ms-cv: jkDUEFxq6E2BFPuvbj9mvw.0
date: Mon, 08 Mar 2021 17:42:22 GMT
ms-cv: p8LAzJzR9E+kJFtKVtPS4w.0
request-context: appId=
transfer-encoding: chunked
x-processing-time: 1670ms
x-processing-time: 1101ms
status:
code: 200
message: OK
Expand Down
Loading