Skip to content

Commit 974852b

Browse files
authored
Merge pull request #48 from oracle/release_2018-02-22
Releasing version 1.3.15
2 parents 7062f9e + e898e1a commit 974852b

Some content is hidden

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

47 files changed

+7426
-54
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ env/
1919
docs/warnings.txt
2020
docs/_build/
2121
docs/apidocs/
22-
oraclebmc/models/init_*
2322
tests/resources/test_debug.log
23+
tests/resources/*.bin
24+
tests/temp
25+
.vscode/
26+
.wercker/
27+
temp

CHANGELOG.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ 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.15 - 2018-02-22
9+
====================
10+
11+
Added
12+
-----
13+
* Support for File Storage Service
14+
15+
* An example on using the File Storage Service can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/file_storage_example.py>`__.
16+
17+
* Added support for tagging Bucket resources in the Object Storage Service
18+
19+
* An example on tagging buckets can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/object_storage_bucket_tagging_example.py>`__.
20+
21+
* Added support for specifying a restore period for archived objects in the ``RestoreObjects`` operation of the Object Storage service.
22+
23+
* An example on using archive storage can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/object_storage_archive_example.py>`__.
24+
725
====================
826
1.3.14 - 2018-02-08
927
====================

docs/api/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,28 @@ Virtual Network
117117
:imported-members:
118118
:inherited-members:
119119

120+
==============
121+
File Storage
122+
==============
123+
124+
--------
125+
Client
126+
--------
127+
128+
.. autoclass:: oci.file_storage.file_storage_client.FileStorageClient
129+
:members:
130+
131+
--------
132+
Models
133+
--------
134+
135+
.. automodule:: oci.file_storage.models
136+
:special-members: __init__
137+
:members:
138+
:undoc-members:
139+
:imported-members:
140+
:inherited-members:
141+
120142
==========
121143
Identity
122144
==========
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _read-connection-timeout:
2+
3+
.. raw:: html
4+
5+
<script type='text/javascript'>
6+
var oldDocsHost = 'oracle-bare-metal-cloud-services-python-sdk';
7+
if (window.location.href.indexOf(oldDocsHost) != -1) {
8+
window.location.href = 'https://oracle-bare-metal-cloud-services-python-sdk.readthedocs.io/en/latest/deprecation-notice.html';
9+
}
10+
</script>
11+
12+
Setting connection and read timeouts
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
The Python SDK uses the `Requests <http://docs.python-requests.org/en/master/>`_ library to make calls to OCI services. The SDK uses the Requests `definition <http://docs.python-requests.org/en/master/user/advanced/#timeouts>`_ for connection and read timeouts.
15+
16+
By default, calls made to OCI services have no connection or read timeout associated with them (i.e. it is possible to wait forever for a response). If you wish to override this default behaviour and set a timeout, you can do something similar to:
17+
18+
.. code-block:: python
19+
20+
import oci
21+
22+
config = oci.config.from_file()
23+
compute = oci.core.ComputeClient(config)
24+
25+
# This will set a value of 5 seconds to the connection and read timeout
26+
compute.base_client.timeout = 5
27+
28+
# This will set the connection timeout to 2 seconds and the read timeout to 25 seconds
29+
compute.base_client.timeout = (2, 25)
30+
31+
32+
You can modify the ``timeout`` attribute of the ``base_client`` to customize our connection and read timeouts. This attribute takes input in the same format as `Requests <http://docs.python-requests.org/en/master/>`_ does, namely:
33+
34+
* A single value will be applied to both the connection and read timeouts
35+
* If a tuple is provided then the first value is used as the connection timeout and the second as the read timeout
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _customize-service-client:
2+
3+
4+
Customizing Service Clients
5+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+
SDK service clients can be customized in the following ways:
7+
8+
* :doc:`Setting connection and read timeouts for requests </customize_service_client/connection_read_timeout>`
9+
* :doc:`Using the SDK with a proxy server </sdk-with-proxy>`
10+
* :doc:`Injecting custom headers into requests </customize_service_client/setting_custom_headers>`
11+
12+
.. toctree::
13+
:hidden:
14+
:maxdepth: 2
15+
16+
connection_read_timeout
17+
/sdk-with-proxy
18+
setting_custom_headers
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. _setting-custom-headers:
2+
3+
.. raw:: html
4+
5+
<script type='text/javascript'>
6+
var oldDocsHost = 'oracle-bare-metal-cloud-services-python-sdk';
7+
if (window.location.href.indexOf(oldDocsHost) != -1) {
8+
window.location.href = 'https://oracle-bare-metal-cloud-services-python-sdk.readthedocs.io/en/latest/deprecation-notice.html';
9+
}
10+
</script>
11+
12+
Setting custom headers
13+
~~~~~~~~~~~~~~~~~~~~~~~
14+
The Python SDK uses the `Requests <http://docs.python-requests.org/en/master/>`_ library to make calls to OCI services. If you need to add custom headers to your calls, you can do so via modifying the underlying Requests `Session <http://docs.python-requests.org/en/master/api/#request-sessions>`_ object
15+
16+
.. code-block:: python
17+
18+
import oci
19+
20+
config = oci.config.from_file()
21+
compute = oci.core.ComputeClient(config)
22+
23+
# Adds my-custom-header as a header in the request. This header will be included in ALL
24+
# subsequent calls made
25+
compute.base_client.session.headers['my-custom-header'] = 'my custom header value'
26+
27+
# If you no longer want to send the header then remove it from the dictionary
28+
compute.base_client.session.headers.pop('my-custom-header')
29+

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ To get started, head over to the :ref:`installation instructions <install>` or s
5454
raw-requests
5555
waiters
5656
pagination
57-
sdk-with-proxy
5857
api/index
58+
customize_service_client/index
5959
contributions
6060
notifications
6161
license

docs/quickstart.rst

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,24 @@ compartment:
104104
Even though a response includes a next page, there may not be more results. The last page will return an empty list,
105105
and will not have a ``next_page`` token.
106106

107-
Here's a very simple way to paginate a call:
107+
You can manually iterate through responses, providing the page from the previous response to the next request. For example:
108108

109109
.. code-block:: python
110110
111-
def paginate(operation, *args, **kwargs):
112-
while True:
113-
response = operation(*args, **kwargs)
114-
for value in response.data:
115-
yield value
116-
kwargs["page"] = response.next_page
117-
if not response.has_next_page:
118-
break
111+
response = identity.list_users(compartment_id)
112+
users = response.data
113+
while response.has_next_page:
114+
response = identity.list_users(compartment_id, page=response.next_page)
115+
users.extend(response.data)
119116
120-
To iterate over all users, the call is now:
121117
122-
.. code-block:: pycon
118+
As a convenience over manually writing pagination code, you can make use of the functions in the :py:mod:`~oci.pagination` module to:
123119

124-
>>> for user in paginate(
125-
... identity.list_users,
126-
... compartment_id=compartment_id):
127-
... print(user)
120+
* Eagerly load all possible results from a list call
121+
* Eagerly load all results from a list call up to a given limit
122+
* Lazily load results (either all results, or up to a given limit) from a list call via a generator. These generators can yield either values/models or the raw response from calling the list operation
128123

129-
This ``paginate`` function will work for any list call, but will not include the response metadata, such as headers,
130-
HTTP status code, or request id.
124+
For examples on pagination, please check `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/pagination.py>`__.
131125

132126

133127
-------------------
@@ -216,7 +210,7 @@ And to get it back:
216210
============
217211

218212
Next, head to the `User Guides`_ or jump right into the :ref:`API Reference <api-reference>`
219-
to explore the available operations for each service, and their parameters. Additional Python examples can be found on `GitHub <https://github.com/oracle/oci-python-sdk/tree/master/examples>`_.
213+
to explore the available operations for each service, and their parameters. Additional Python examples can be found on `GitHub <https://github.com/oracle/oci-python-sdk/tree/master/examples>`__.
220214

221215

222216
.. note::

0 commit comments

Comments
 (0)