Skip to content

Commit

Permalink
update release date and doc (Azure#21969)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 authored Dec 2, 2021
1 parent 118fef8 commit 46fa4a7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 28 deletions.
6 changes: 1 addition & 5 deletions sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Release History

## 1.20.2 (Unreleased)

### Features Added
## 1.21.0 (2021-12-02)

### Breaking Changes

Expand All @@ -12,8 +10,6 @@

- Add response body to string representation of `HttpResponseError` if we're not able to parse out information #21800

### Other Changes

## 1.20.1 (2021-11-08)

### Bugs Fixed
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ from azure.core.pipeline.policies import (
| | | retry_status | x | x | How many times to retry on bad status codes. Default value is `3`. |
| | | retry_backoff_factor | x | x | A backoff factor to apply between attempts after the second try (most errors are resolved immediately by a second try without a delay). Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` seconds. If the backoff_factor is 0.1, then the retry will sleep for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is `0.8`. |
| | | retry_backoff_max | x | x | The maximum back off time. Default value is `120` seconds (2 minutes). |
| | | retry_mode | x | x | Fixed or exponential delay between attemps, default is `exponential`. |
| | | retry_mode | x | x | Fixed or exponential delay between attempts, default is `exponential`. |
| | | timeout | x | x | Timeout setting for the operation in seconds, default is `604800s` (7 days). |
| AsyncRetryPolicy | AsyncHTTPPolicy | | | | |
| | | retry_total | x | x | Total number of retries to allow. Takes precedence over other counts. Default value is `10`. |
Expand All @@ -478,7 +478,7 @@ from azure.core.pipeline.policies import (
| | | retry_status | x | x | How many times to retry on bad status codes. Default value is `3`. |
| | | retry_backoff_factor | x | x | A backoff factor to apply between attempts after the second try (most errors are resolved immediately by a second try without a delay). Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` seconds. If the backoff_factor is 0.1, then the retry will sleep for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is `0.8`. |
| | | retry_backoff_max | x | x | The maximum back off time. Default value is `120` seconds (2 minutes). |
| | | retry_mode | x | x | Fixed or exponential delay between attemps, default is exponential. |
| | | retry_mode | x | x | Fixed or exponential delay between attempts, default is exponential. |
| | | timeout | x | x | Timeout setting for the operation in seconds, default is `604800s` (7 days). |

### The Pipeline
Expand Down
63 changes: 43 additions & 20 deletions sdk/core/azure-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you are a client library developer, please reference [client library develope

## _Disclaimer_

_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to <https://github.com/Azure/azure-sdk-for-python/issues/20691>_

## Getting started

Expand All @@ -24,56 +24,61 @@ you can find it [here](https://pypi.org/project/azure-core/).
### Azure Core Library Exceptions

#### AzureError

AzureError is the base exception for all errors.

```python
class AzureError(Exception):
def __init__(self, message, *args, **kwargs):
self.inner_exception = kwargs.get('error')
self.inner_exception = kwargs.get("error")
self.exc_type, self.exc_value, self.exc_traceback = sys.exc_info()
self.exc_type = self.exc_type.__name__ if self.exc_type else type(self.inner_exception)
self.exc_msg = "{}, {}: {}".format(message, self.exc_type, self.exc_value) # type: ignore
self.message = str(message)
self.continuation_token = kwargs.get("continuation_token")
super(AzureError, self).__init__(self.message, *args)
```

*message* is any message (str) to be associated with the exception.

*args* are any additional args to be included with exception.

*kwargs* are keyword arguments to include with the exception. Use the keyword *error* to pass in an internal exception.
*kwargs* are keyword arguments to include with the exception. Use the keyword *error* to pass in an internal exception and *continuation_token* for a token reference to continue an incomplete operation.

**The following exceptions inherit from AzureError:**

#### ServiceRequestError

An error occurred while attempt to make a request to the service. No request was sent.

#### ServiceResponseError

The request was sent, but the client failed to understand the response.
The connection may have timed out. These errors can be retried for idempotent or safe operations.

#### HttpResponseError

A request was made, and a non-success status code was received from the service.

```python
class HttpResponseError(AzureError):
def __init__(self, message=None, response=None, **kwargs):
self.reason = None
self.response = response
if response:
self.reason = response.reason
message = "Operation returned an invalid status code '{}'".format(self.reason)
try:
try:
if self.error.error.code or self.error.error.message:
message = "({}) {}".format(
self.error.error.code,
self.error.error.message)
except AttributeError:
if self.error.message: #pylint: disable=no-member
message = self.error.message #pylint: disable=no-member
except AttributeError:
pass
self.status_code = response.status_code
self.error = self._parse_odata_body(ODataV4Format, response) # type: Optional[ODataV4Format]
if self.error:
message = str(self.error)
else:
message = message or "Operation returned an invalid status '{}'".format(
self.reason
)

super(HttpResponseError, self).__init__(message=message, **kwargs)
```

*message* is the HTTP response error message (optional)

*response* is the HTTP response (optional).
Expand All @@ -83,25 +88,37 @@ class HttpResponseError(AzureError):
**The following exceptions inherit from HttpResponseError:**

#### DecodeError
An error raised during response deserialization.

An error raised during response de-serialization.

#### IncompleteReadError

An error raised if peer closes the connection before we have received the complete message body.

#### ResourceExistsError

An error response with status code 4xx. This will not be raised directly by the Azure core pipeline.

#### ResourceNotFoundError
An error response, typically triggered by a 412 response (for update) or 404 (for get/post).

#### ClientAuthenticationError
An error response with status code 4xx. This will not be raised directly by the Azure core pipeline.
An error response, typically triggered by a 412 response (for update) or 404 (for get/post).

#### ResourceModifiedError

An error response with status code 4xx, typically 412 Conflict. This will not be raised directly by the Azure core pipeline.

#### ResourceNotModifiedError

An error response with status code 304. This will not be raised directly by the Azure core pipeline.

#### ClientAuthenticationError

An error response with status code 4xx. This will not be raised directly by the Azure core pipeline.

#### TooManyRedirectsError

An error raised when the maximum number of redirect attempts is reached. The maximum amount of redirects can be configured in the RedirectPolicy.

```python
class TooManyRedirectsError(HttpResponseError):
def __init__(self, history, *args, **kwargs):
Expand All @@ -117,14 +134,17 @@ class TooManyRedirectsError(HttpResponseError):
*kwargs* are keyword arguments to include with the exception.

#### StreamConsumedError

An error thrown if you try to access the stream of `azure.core.rest.HttpResponse` or `azure.core.rest.AsyncHttpResponse` once
the response stream has been consumed.

#### StreamClosedError

An error thrown if you try to access the stream of the `azure.core.rest.HttpResponse` or `azure.core.rest.AsyncHttpResponse` once
the response stream has been closed.

#### ResponseNotReadError

An error thrown if you try to access the `content` of `azure.core.rest.HttpResponse` or `azure.core.rest.AsyncHttpResponse` before
reading in the response's bytes first.

Expand Down Expand Up @@ -153,7 +173,7 @@ When calling the methods, some properties can be configured by passing in as kwa
| retry_status | How many times to retry on bad status codes. Default value is `3`. |
| retry_backoff_factor | A backoff factor to apply between attempts after the second try (most errors are resolved immediately by a second try without a delay). Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` seconds. If the backoff_factor is 0.1, then the retry will sleep for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is `0.8`. |
| retry_backoff_max | The maximum back off time. Default value is `120` seconds (2 minutes). |
| retry_mode | Fixed or exponential delay between attemps, default is `Exponential`. |
| retry_mode | Fixed or exponential delay between attempts, default is `Exponential`. |
| timeout | Timeout setting for the operation in seconds, default is `604800`s (7 days). |
| connection_timeout | A single float in seconds for the connection timeout. Defaults to `300` seconds. |
| read_timeout | A single float in seconds for the read timeout. Defaults to `300` seconds. |
Expand All @@ -172,6 +192,7 @@ The async transport is designed to be opt-in. [AioHttp](https://pypi.org/project
#### MatchConditions

MatchConditions is an enum to describe match conditions.

```python
class MatchConditions(Enum):
Unconditionally = 1
Expand All @@ -184,6 +205,7 @@ class MatchConditions(Enum):
#### CaseInsensitiveEnumMeta

A metaclass to support case-insensitive enums.

```python
from enum import Enum
from six import with_metaclass
Expand Down Expand Up @@ -211,6 +233,7 @@ foo = Foo(
```

## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "1.20.2"
VERSION = "1.21.0"

0 comments on commit 46fa4a7

Please sign in to comment.