Skip to content

Commit ae08ede

Browse files
authored
Merge pull request #51 from oracle/release_2018-03-26
Releasing version 1.3.17
2 parents 20201e0 + c21e55a commit ae08ede

File tree

353 files changed

+4182
-782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+4182
-782
lines changed

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.
66

7+
====================
8+
1.3.17 - 2018-03-26
9+
====================
10+
11+
Added
12+
------
13+
* Added support for remote VCN peering across regions
14+
15+
* An example on how to perform these operations can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/remote_peering_connection_example.py>`__.
16+
17+
* Added support for calling Oracle Cloud Infrastructure services in the uk-london-1 (LHR) region
18+
19+
720
====================
821
1.3.16 - 2018-03-08
922
====================

docs/exceptions.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. _exception-handling:
2+
3+
Exception handling
4+
~~~~~~~~~~~~~~~~~~~~~~
5+
When using the Python SDK, you should be prepared to handle the following exceptions:
6+
7+
* Any response received by the SDK with a non-2xx HTTP status will be thrown as a :py:class:`~oci.exceptions.ServiceError`
8+
* A ``ValueError`` will be thrown if you provide invalid parameters to a method call or when setting an attribute. For example:
9+
10+
* When setting an attribute on a model and that attribute has a constrained set of values, such as :py:attr:`~oci.core.models.CreatePublicIpDetails.lifetime` on ``CreatePublicIpDetails``
11+
* When passing a blank string as the identifier for a ``get_`` operation, such as passing a nil ``instance_id`` to :py:meth:`~oci.core.compute_client.ComputeClient.get_instance`
12+
13+
* :py:class:`~oci.exceptions.ClientError` and its subclasses. These exceptions are raised when there is an error with your configuration file or when using the :py:meth:`~oci.wait_until` function
14+
15+
* :py:class:`~oci.exceptions.ConfigFileNotFound`
16+
* :py:class:`~oci.exceptions.InvalidConfig`
17+
* :py:class:`~oci.exceptions.InvalidPrivateKey`
18+
* :py:class:`~oci.exceptions.MissingPrivateKeyPassphrase`
19+
* :py:class:`~oci.exceptions.ProfileNotFound`
20+
* :py:class:`~oci.exceptions.WaitUntilNotSupported`
21+
* :py:class:`~oci.exceptions.MaximumWaitTimeExceeded`
22+
23+
* If you use the :py:class:`~oci.object_storage.UploadManager` then you should also catch :py:class:`~oci.exceptions.MultipartUploadError`
24+
25+
* The Python SDK uses the `Requests <http://docs.python-requests.org/en/master/>`_ library to make calls to OCI services but it does not mask or wrap any of the errors originating from this library, so you should also account for these in your code. The exception reference for Requests can be found `here <http://docs.python-requests.org/en/master/_modules/requests/exceptions/>`__ and `here <http://docs.python-requests.org/en/master/api/#exceptions>`__
26+
27+
Handling HTTP 3xx responses
28+
============================
29+
As a result of the SDK treating responses with a non-2xx HTTP status as a :py:class:`~oci.exceptions.ServiceError` the SDK will throw a :py:class:`~oci.exceptions.ServiceError` on 3xx responses. This can impact operations which support conditional GETs, such as :py:meth:`~oci.object_storage.object_storage_client.ObjectStorageClient.get_object` and :py:meth:`~oci.object_storage.object_storage_client.ObjectStorageClient.head_object` methods as these can return responses with a HTTP status code of 304 if passed an ``if_none_match`` which corresponds to the curent etag of the object or bucket.
30+
31+
In order to account for this, you should catch :py:class:`~oci.exceptions.ServiceError` and check its ``status`` attribute for the HTTP status code. For example:
32+
33+
.. code-block:: python
34+
35+
import oci
36+
37+
config = oci.config.from_file()
38+
client = oci.object_storage.ObjectStorageClient(config)
39+
40+
try:
41+
get_object_response = client.get_object('my_namespace', 'my_bucket', 'my_object', if_none_match='some_etag_value')
42+
except oci.exceptions.ServiceError as e:
43+
if e.status == 304:
44+
# Object exists but has not been modified (based on the etag value)
45+
pass
46+
else:
47+
raise

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ To get started, head over to the :ref:`installation instructions <install>` or s
4848
backward-compatibility
4949
quickstart
5050
logging
51+
exceptions
5152
upload-manager
5253
raw-requests
5354
waiters

docs/sdk-with-proxy.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ In order to modify the underlying Session object, you can do something similar t
3030
3131
The key parts are that the underlying Session object can be accessed via ``base_client.session`` and we can then modify the `proxies <http://docs.python-requests.org/en/master/api/#requests.Session.proxies>`_
3232
dictionary to add any required proxies.
33+
34+
If your proxy uses HTTP Basic Auth, then when setting ``base_client.session.proxies`` you can use the *http://user:password@host/* syntax to provide the username and password. For example:
35+
36+
.. code-block:: python
37+
38+
compute.base_client.session.proxies = { 'https': 'http://myuser:[email protected]:80' }

docs/sdk_behaviors/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ This section describes SDK-specific behaviors:
77
* :doc:`Handling naive datetimes </sdk_behaviors/handle_naive_datetime>`
88
* :doc:`Parallel operations </parallel-ops>`
99
* :doc:`Passing explicit null/None values </pass-explicit-null>`
10+
* :doc:`Retries </sdk_behaviors/retries>`
1011

1112
.. toctree::
1213
:hidden:
1314
:maxdepth: 2
1415

1516
handle_naive_datetime
1617
/parallel-ops
17-
/pass-explicit-null
18+
/pass-explicit-null
19+
retries

docs/sdk_behaviors/retries.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _sdk-retries:
2+
3+
Retries
4+
~~~~~~~~
5+
By default, operations exposed in the SDK do not retry, but retries can be set in the SDK on a per-operation basis. Each operation accepts a
6+
``retry_strategy`` keyword argument which can be used to set the retry strategy for that operation. This retry stategy could be:
7+
8+
* The default strategy vended by the SDK as :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY`
9+
* The :py:class:`~oci.retry.NoneRetryStrategy`. This will result in no retries being performed for the operation
10+
* A custom strategy produced via the :py:class:`~oci.retry.RetryStrategyBuilder`
11+
12+
A sample on using retries, including the default strategy and a custom strategy, can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/retries.py>`
13+
14+
Default Retry Strategy
15+
------------------------
16+
The default retry strategy vended by the SDK has the following attributes:
17+
18+
* 5 total attempts
19+
* Total allowed elapsed time for all requests of 300 seconds (5 minutes)
20+
* Exponential backoff with jitter, using:
21+
22+
* The base time to use in retry calculations will be 1 second
23+
* An exponent of 2. When calculating the next retry time we will raise this to the power of the number of attempts
24+
* A maximum wait time between calls of 30 seconds
25+
26+
* Exponential backoff with equal jitter is used for throttles as this guarantees some sleep time between attempts. The sleep time in this circumstance is calculated as:
27+
28+
.. code-block:: none
29+
30+
exponential_backoff_sleep_base = min(base_time * (exponent ** attempt_number), max_wait_time)
31+
sleep_time = (exponential_backoff_sleep_base / 2.0) + random(0, exponential_backoff_sleep_base / 2.0)
32+
33+
* Exponential backoff with full jitter is used for other scenarios where we need to retry (e.g. timeouts, HTTP 5xx). The sleep time in this circumstance is calculated as:
34+
35+
.. code-block:: none
36+
37+
exponential_backoff_sleep_base = min(base_time * (exponent ** attempt_number), max_wait_time)
38+
sleep_time = random(0, exponential_backoff_sleep_base)
39+
40+
* Retries on the following exception types:
41+
42+
* Timeouts and connection errors
43+
* HTTP 429s (throttles)
44+
* HTTP 5xx (server errors)

0 commit comments

Comments
 (0)