forked from docs/doc-exports
OBS Python SDK 0430 Version
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: weihongmin1 <weihongmin1@huawei.com> Co-committed-by: weihongmin1 <weihongmin1@huawei.com>
This commit is contained in:
1823
docs/obs_3rd_party/python_sdk/ALL_META.TXT.json
vendored
Normal file
1823
docs/obs_3rd_party/python_sdk/ALL_META.TXT.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
911
docs/obs_3rd_party/python_sdk/CLASS.TXT.json
vendored
Normal file
911
docs/obs_3rd_party/python_sdk/CLASS.TXT.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
docs/obs_3rd_party/python_sdk/PARAMETERS.txt
vendored
Normal file
3
docs/obs_3rd_party/python_sdk/PARAMETERS.txt
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
version=""
|
||||
language="en-us"
|
||||
type=""
|
||||
8
docs/obs_3rd_party/python_sdk/obs_22_0001.html
vendored
Normal file
8
docs/obs_3rd_party/python_sdk/obs_22_0001.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<a name="obs_22_0001"></a><a name="obs_22_0001"></a>
|
||||
|
||||
<h1 class="topictitle1">Before You Start (SDK for Python)</h1>
|
||||
<div id="body0000001653380734"><p id="obs_22_0001__p4829175282110">This section describes the important notes about Object Storage Service (OBS) SDK for Python.</p>
|
||||
<div class="section" id="obs_22_0001__section1799812136145"><h4 class="sectiontitle">Important Notes</h4><ul id="obs_22_0001__ul13319854171617"><li id="obs_22_0001__li1455835565112">Some features are available only in some regions. If <strong id="obs_22_0001__b1668395319432">405</strong> HTTP status code is returned for a call of a certain feature API, check whether the region supports this feature. </li><li id="obs_22_0001__li15847144810261">The namespace is incompatible with earlier OBS versions (2.1.<em id="obs_22_0001__i1365695662110">x</em>). All modules are saved in the <strong id="obs_22_0001__b1073632825315">obs</strong> package.</li><li id="obs_22_0001__li16847144813267">API functions are compatible with earlier OBS versions (2.1.<em id="obs_22_0001__i185511736103114">x</em>).</li></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
419
docs/obs_3rd_party/python_sdk/obs_22_0100.html
vendored
Normal file
419
docs/obs_3rd_party/python_sdk/obs_22_0100.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
docs/obs_3rd_party/python_sdk/obs_22_0300.html
vendored
Normal file
22
docs/obs_3rd_party/python_sdk/obs_22_0300.html
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
<a name="obs_22_0300"></a><a name="obs_22_0300"></a>
|
||||
|
||||
<h1 class="topictitle1">Preparations (SDK for Python)</h1>
|
||||
<div id="body0000001653540046"><p id="obs_22_0300__p21029501259">Before using OBS SDK for Python to access OBS, you need to prepare the service and development environments. To prepare the service environment, you must get an account and an access key. Both of them are necessary for interaction between OBS SDK for Python and OBS. To ensure successful SDK installation and SDK-based code development and running, you should also set up a local development environment, for example, installing dependencies and development tools.</p>
|
||||
<div class="section" id="obs_22_0300__section458414452394"><h4 class="sectiontitle">Preparing Access Keys</h4><p id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_adeb035c840bc4ef48f20dad1b3cb6a5a">Access keys consist of two parts: an access key ID (AK) and a secret access key (SK). OBS uses access keys to sign requests to make sure that only authorized accounts can access specified OBS resources. Programmatic access must be enabled for an IAM user before the IAM user can get access keys. Access keys are explained as follows:</p>
|
||||
<ul id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_ud824bd53c08f4de298b5cae667f92384"><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_l3b5b9503106c49a8b5489ac8e11cb945">One AK maps to only one user but one user can have multiple AKs. OBS authenticates users by their AKs.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_lebae2a3195404969a625b86fe868e0fc">An SK is required for accessing OBS. Authentication information is generated based on the SK and request headers. AKs and SKs are in one-to-one match.</li></ul>
|
||||
<p id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_p948210412118">Access keys are classified into permanent access keys (AK/SK) and temporary access keys (AK/SK and security token). Each user can create at most two permanent access keys. Temporary access keys must be used within a given validity period. Once expired, they must be requested again. For security purposes, you are advised to use temporary access keys to access OBS. If you want to use permanent access keys, periodically update them. The following describes how to obtain two types of access keys.</p>
|
||||
<ul id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_ul9129162663715"><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li81311626163714">To get permanent access keys, do as follows:<ol id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_ol12129204810375"><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li131293485375">Log in to the management console.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li101298483377">In the upper right corner, hover over the username and choose <strong id="obs_22_0300__en-us_topic_0000001605096753_b17591164012493">My Credentials</strong>.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_en-us_topic_0142814371_li111081813183213">On the <strong id="obs_22_0300__en-us_topic_0000001605096753_b18139126115219">My Credentials</strong> page, click <strong id="obs_22_0300__en-us_topic_0000001605096753_b51407261528">Access Keys</strong> in the navigation pane.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_en-us_topic_0142814371_li875452123217">On the <strong id="obs_22_0300__en-us_topic_0000001605096753_b91191634165219">Access Keys</strong> page, click <strong id="obs_22_0300__en-us_topic_0000001605096753_b812013405217">Create Access Key</strong>.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li14130154815372">In the displayed dialog box, enter the login password and verification code.<div class="note" id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_ne3044baf037f4f74831f421bae0642f4"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_ub83092010ba24ab3a97c3a6bb6843b49"><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_l867bd009af974128bdc09dc992a337c4">If you have not bound an email address or a mobile number yet, only the login password is required.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_l120dd294d40949828d8aba973cabbce9">If you have bound both an email address and a mobile number, you can use either of them for verification.</li></ul>
|
||||
</div></div>
|
||||
</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li51308480374">Click <strong id="obs_22_0300__en-us_topic_0000001605096753_b697654110536">OK</strong>.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li111301648153720">Click <strong id="obs_22_0300__en-us_topic_0000001605096753_b27871448155318">Download</strong>. The access key file is automatically saved to your browser's default download path.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li121309481375">Open the downloaded <strong id="obs_22_0300__en-us_topic_0000001605096753_b147765975617">credentials.csv</strong> file to obtain the access keys (AK and SK).<div class="note" id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_n4cf417b871b6496c9448eb3f8dfc9f60"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_u72ac6ae546604f27b36f81aa196f3784"><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_lae8640b2fda847399d8689ba5eba3b14">Each user can create a maximum of two valid access key pairs.</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_l877538a6162b4fbcbd62b302a07ade4a">Keep AKs and SKs properly to prevent information leakage. If you click <strong id="obs_22_0300__en-us_topic_0000001605096753_b39111215216">Cancel</strong> in the download dialog box, the access keys will not be downloaded and cannot be downloaded later. You can create a new AK/SK pair if needed.</li></ul>
|
||||
</div></div>
|
||||
</li></ol>
|
||||
</li><li id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li188121361385">To get temporary access keys, refer to the following:<p id="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_p1387017162467"><a name="obs_22_0300__en-us_topic_0000001605096753_en-us_topic_0000001526886348_li188121361385"></a><a name="en-us_topic_0000001605096753_en-us_topic_0000001526886348_li188121361385"></a>Temporary access keys are issued by the system and are only valid for 15 minutes to 24 hours. Once expired, they must be requested again. They follow the principle of least privilege. When a temporary AK/SK pair is used for authentication, a security token must be used at the same time.</p>
|
||||
</li></ul>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0300__section148405311417"><h4 class="sectiontitle">Setting Up a Development Environment</h4><ul id="obs_22_0300__ul1053982918378"><li id="obs_22_0300__li753912903716">Download a proper Python version from the <a href="https://www.python.org/" target="_blank" rel="noopener noreferrer">Python official website</a> and install it.<ul id="obs_22_0300__ul772017265535"><li id="obs_22_0300__li61423713379">Recommended Python 2.<em id="obs_22_0300__i1930461918236">x</em> version: 2.7.<em id="obs_22_0300__i3305101910236">x</em></li><li id="obs_22_0300__li7720192635313">Recommended Python 3.<em id="obs_22_0300__i135091116988">x</em> versions: 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11</li></ul>
|
||||
<div class="note" id="obs_22_0300__note3171222004"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_22_0300__p34821971111">Python 3.5 and earlier versions are not recommended. If you need to use these versions, run the <strong id="obs_22_0300__b242512258438">pip install secrets</strong> command to install the secrets module. You can install python2-secrets on Python 2.7.</p>
|
||||
</div></div>
|
||||
</li><li id="obs_22_0300__li10670194495616">Download the latest community version of PyCharm from the <a href="https://www.jetbrains.com/pycharm/" target="_blank" rel="noopener noreferrer">PyCharm official website</a>.</li><li id="obs_22_0300__li10231161061812">Run <strong id="obs_22_0300__b368717106287">pip install pycryptodome==3.10.1</strong> to install the cryptographic library.</li></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
45
docs/obs_3rd_party/python_sdk/obs_22_0400.html
vendored
Normal file
45
docs/obs_3rd_party/python_sdk/obs_22_0400.html
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
<a name="obs_22_0400"></a><a name="obs_22_0400"></a>
|
||||
|
||||
<h1 class="topictitle1">Downloading and Installing OBS SDK for Python</h1>
|
||||
<div id="body0000001701740257"><p id="obs_22_0400__p67061927105716">This topic provides the download links and installation methods of OBS SDK for Python.</p>
|
||||
<div class="section" id="obs_22_0400__section1585712245441"><h4 class="sectiontitle">Downloading OBS SDK for Python</h4><p id="obs_22_0400__p1768148184610">Latest version of OBS Python SDK source code: <a href="https://github.com/object-storage-sdk/obs-python-sdk" target="_blank" rel="noopener noreferrer">Download</a></p>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0400__section31091719144715"><h4 class="sectiontitle">Installing OBS SDK for Python</h4><p id="obs_22_0400__p1083162214718">You can use the methods listed in <a href="#obs_22_0400__table6377143115452">Table 1</a> to install OBS SDK for Python.</p>
|
||||
|
||||
<div class="tablenoborder"><a name="obs_22_0400__table6377143115452"></a><a name="table6377143115452"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_22_0400__table6377143115452" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Methods of installing OBS SDK for Python</caption><thead align="left"><tr id="obs_22_0400__row4377143119455"><th align="left" class="cellrowborder" valign="top" width="13.73%" id="mcps1.3.3.3.2.3.1.1"><p id="obs_22_0400__p167216587390">No.</p>
|
||||
</th>
|
||||
<th align="left" class="cellrowborder" valign="top" width="86.27%" id="mcps1.3.3.3.2.3.1.2"><p id="obs_22_0400__p637773144513">Method</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="obs_22_0400__row176281910182712"><td class="cellrowborder" valign="top" width="13.73%" headers="mcps1.3.3.3.2.3.1.1 "><p id="obs_22_0400__p197275815397">1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="86.27%" headers="mcps1.3.3.3.2.3.1.2 "><p id="obs_22_0400__p8904252134915"><a href="#obs_22_0400__section6866125102510">Installing Using the Source Code</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="obs_22_0400__row1137718317459"><td class="cellrowborder" valign="top" width="13.73%" headers="mcps1.3.3.3.2.3.1.1 "><p id="obs_22_0400__p77061378015">2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="86.27%" headers="mcps1.3.3.3.2.3.1.2 "><p id="obs_22_0400__p125121701502"><a href="#obs_22_0400__section66901737144816">Installing the SDK Using setuptools</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0400__section6866125102510"><a name="obs_22_0400__section6866125102510"></a><a name="section6866125102510"></a><h4 class="sectiontitle">Method: Installing the SDK Using the Source Code</h4><p id="obs_22_0400__p62393242307">The following procedures show an example of installing the latest version of OBS Python SDK.</p>
|
||||
</div>
|
||||
<ol id="obs_22_0400__ol14218134154914"><li id="obs_22_0400__li7218153464914"><span> the SDK package and decompress it.</span></li><li id="obs_22_0400__li14218934194911"><span>Run <strong id="obs_22_0400__b0787125710581">pip install pycryptodome==3.10.1</strong> to install the cryptographic library.</span></li><li id="obs_22_0400__li3218163464918"><span>Decompress the development package to obtain folder <strong id="obs_22_0400__b1461175917586">src</strong> (SDK source code), folder <strong id="obs_22_0400__b746245920587">examples</strong> (sample code), file <strong id="obs_22_0400__b1446218597587">README.txt</strong> (feature description file of SDK versions), and file <strong id="obs_22_0400__b5462359205811">log.conf</strong> (SDK log configuration file).</span></li><li id="obs_22_0400__li122189343495"><span>Use PyCharm to create a project, copy the folders and files obtained in the previous step to the project, right-click folder <strong id="obs_22_0400__b2085911214596">src</strong>, and choose <strong id="obs_22_0400__b15860121225920">Mark Directory as</strong> > <strong id="obs_22_0400__b5860512175914">Sources Root</strong>.</span><p><div class="note" id="obs_22_0400__note14721414124518"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_22_0400__p52031618135913">After the configuration, the directory structure is similar to the following:</p>
|
||||
<p id="obs_22_0400__p7879023122220">├── examples</p>
|
||||
<p id="obs_22_0400__p2088082322215">├── src</p>
|
||||
<p id="obs_22_0400__p1788019231223">├── log.conf</p>
|
||||
<p id="obs_22_0400__p1888092352218">└── README.md</p>
|
||||
</div></div>
|
||||
</p></li></ol>
|
||||
<div class="section" id="obs_22_0400__section66901737144816"><a name="obs_22_0400__section66901737144816"></a><a name="section66901737144816"></a><h4 class="sectiontitle">Method: Installing the SDK Using setuptools</h4><p id="obs_22_0400__p294440124814">The following procedures show an example of installing the latest version of OBS Python SDK.</p>
|
||||
</div>
|
||||
<ol id="obs_22_0400__ol5179440184915"><li id="obs_22_0400__li193465493562"><span> the SDK package and decompress it.</span></li><li id="obs_22_0400__li10179194018499"><span>Download and install <a href="https://pypi.python.org/pypi/setuptools/" target="_blank" rel="noopener noreferrer">setuptools</a>.</span></li><li id="obs_22_0400__li2179144017491"><span>On the command-line interface (CLI), go to folder <strong id="obs_22_0400__b150415412113">src</strong> under the directory where the development package is decompressed.</span></li><li id="obs_22_0400__li19179134044919"><span>Run the <strong id="obs_22_0400__b18533643014">python setup.py install</strong> command to install the SDK.</span></li><li id="obs_22_0400__li1717924016494"><span>After the installation, check whether a folder named <strong id="obs_22_0400__b125041946313">esdk_obs_python-<versionId>-*.egg</strong> is generated in <strong id="obs_22_0400__b16504164618112">Lib/site-package</strong> under the Python installation directory.</span><p><div class="note" id="obs_22_0400__note123181248122611"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_22_0400__ul173181483261"><li id="obs_22_0400__li73187485264">If you use this method to install the SDK, you need to delete folder <strong id="obs_22_0400__b289910491618">esdk_obs_python-</strong><em id="obs_22_0400__i1490014913117"><versionId></em><strong id="obs_22_0400__b19900349114">-*.egg</strong> when you re-install the SDK.</li><li id="obs_22_0400__li731816486266">If SDK modules cannot be loaded after you have performed the previous steps, you can directly add the absolute path of the <strong id="obs_22_0400__b1075019541912">src</strong> directory in OBS Python SDK to the <strong id="obs_22_0400__b1475116541310">sys.path</strong> list.</li></ul>
|
||||
</div></div>
|
||||
</p></li></ol>
|
||||
</div>
|
||||
<div></div>
|
||||
|
||||
228
docs/obs_3rd_party/python_sdk/obs_22_0500.html
vendored
Normal file
228
docs/obs_3rd_party/python_sdk/obs_22_0500.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
docs/obs_3rd_party/python_sdk/obs_22_0501.html
vendored
Normal file
14
docs/obs_3rd_party/python_sdk/obs_22_0501.html
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<a name="obs_22_0501"></a><a name="obs_22_0501"></a>
|
||||
|
||||
<h1 class="topictitle1">Object Upload Overview (SDK for Python)</h1>
|
||||
<div id="body37624514"><p id="obs_22_0501__p27686757">You can use this API to upload an object to a specified bucket. In OBS, objects are basic data units that you can operate. OBS Python SDK provides many APIs for uploading objects using various methods:</p>
|
||||
<ul id="obs_22_0501__ul1524911913464"><li id="obs_22_0501__li32490914616"><a href="obs_22_0901.html">Text-based upload</a>: Character strings are used as the data source of an object.</li><li id="obs_22_0501__li1824915915461"><a href="obs_22_0902.html">Streaming upload</a>: Readable objects that contain the <strong id="obs_22_0501__b1921112595267">read</strong> attribute are used as the data source of an object.</li><li id="obs_22_0501__li20249119174610"><a href="obs_22_0903.html">File-based upload</a>: Local files are used as the data source of objects.</li><li id="obs_22_0501__li1324915934618"><a href="obs_22_1003.html">Multipart upload</a>: Large files can be uploaded in multiple parts.</li><li id="obs_22_0501__li1324917919469"><a href="obs_22_0904.html">Append upload</a>: You can append data to an object.</li><li id="obs_22_0501__li12495910463"><a href="obs_22_0905.html">Resumable upload</a>: It is an encapsulated and enhanced version of the multipart upload used for dealing with possible upload failures of large files when the network connection is unstable or a program crashes.</li><li id="obs_22_0501__li16249169154616"><a href="obs_22_0907.html">Browser-based upload</a>: You can upload objects to a specified bucket in HTML form.</li></ul>
|
||||
<p id="obs_22_0501__p12495910465">SDK supports the upload of objects whose size ranges from 0 KB to 5 GB. For streaming upload, append upload, and file-based upload, data to be uploaded in a batch cannot be larger than 5 GB. If the file is larger than 5 GB, multipart upload (whose part size is smaller than 5 GB) is suitable. Browser-based upload allows files to be uploaded through a browser.</p>
|
||||
<p id="obs_22_0501__p1622418391727">If you grant anonymous users the read permission for an object during the upload, anonymous users can access the object through a URL after the upload succeeds. The object URL is in the format of <strong id="obs_22_0501__b908005498102126">https://</strong><strong id="obs_22_0501__b689136425102126"><em id="obs_22_0501__i780340517102126">bucket name</em></strong><strong id="obs_22_0501__b2128412940102126">.</strong><strong id="obs_22_0501__b806310509102126"><em id="obs_22_0501__i37188974102126">domain name</em></strong><strong id="obs_22_0501__b887863848102126">/</strong><strong id="obs_22_0501__b581437656102126"><em id="obs_22_0501__i1753135834102126">directory levels</em></strong><strong id="obs_22_0501__b1364934334102126">/</strong><strong id="obs_22_0501__b940110919102126"><em id="obs_22_0501__i1510266198102126">object name</em></strong>. If the object resides in the root directory of a bucket, its URL does not contain a directory level.</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="familylinks">
|
||||
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_22_0900.html">Object-Related APIs (SDK for Python)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
12
docs/obs_3rd_party/python_sdk/obs_22_0502.html
vendored
Normal file
12
docs/obs_3rd_party/python_sdk/obs_22_0502.html
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
<a name="obs_22_0502"></a><a name="obs_22_0502"></a>
|
||||
|
||||
<h1 class="topictitle1">Object Download Overview (SDK for Python)</h1>
|
||||
<div id="body1595942865184"><p id="obs_22_0502__p684819541493">OBS Python SDK provides abundant APIs for downloading objects using various methods:</p>
|
||||
<ul id="obs_22_0502__ul9850125420493"><li id="obs_22_0502__li8850185411496"><a href="obs_22_0908.html">Binary Download</a></li><li id="obs_22_0502__li38501254164911"><a href="obs_22_0909.html">Streaming Download</a></li><li id="obs_22_0502__li15850165444911"><a href="obs_22_0910.html">File-Based Download</a></li><li id="obs_22_0502__li1385085414499"><a href="obs_22_0911.html">Partial Download</a></li><li id="obs_22_0502__li148501554134913"><a href="obs_22_0912.html">Resumable Download</a></li></ul>
|
||||
</div>
|
||||
<div>
|
||||
<div class="familylinks">
|
||||
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_22_0900.html">Object-Related APIs (SDK for Python)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
17
docs/obs_3rd_party/python_sdk/obs_22_0600.html
vendored
Normal file
17
docs/obs_3rd_party/python_sdk/obs_22_0600.html
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<a name="obs_22_0600"></a><a name="obs_22_0600"></a>
|
||||
|
||||
<h1 class="topictitle1">Initialization (SDK for Python)</h1>
|
||||
<div id="body2112619"></div>
|
||||
<div>
|
||||
<ul class="ullinks">
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0601.html">Initializing an Instance of ObsClient (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0602.html">Initializing a BucketClient Instance (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0603.html">Log Initialization (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0604.html">SDK Common Results (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
276
docs/obs_3rd_party/python_sdk/obs_22_0601.html
vendored
Normal file
276
docs/obs_3rd_party/python_sdk/obs_22_0601.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
69
docs/obs_3rd_party/python_sdk/obs_22_0602.html
vendored
Normal file
69
docs/obs_3rd_party/python_sdk/obs_22_0602.html
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<a name="obs_22_0602"></a><a name="obs_22_0602"></a>
|
||||
|
||||
<h1 class="topictitle1">Initializing a BucketClient Instance (SDK for Python)</h1>
|
||||
<div id="body1595942865593"><div class="section" id="obs_22_0602__section102911694610"><h4 class="sectiontitle">Function</h4><p id="obs_22_0602__p1122311515463">BucketClient functions as the Python client for accessing an OBS bucket. It offers users a series of APIs for interaction with OBS. These APIs are used for managing resources, such as buckets and objects, stored in OBS.</p>
|
||||
<p id="obs_22_0602__p15611114616">Except for <strong id="obs_22_0602__b1481720219513">ObsClient.listBuckets</strong>, <strong id="obs_22_0602__b3817621953">ObsClient.downloadFile</strong>, <strong id="obs_22_0602__b15817521050">Obsclient.uploadFile</strong>, <strong id="obs_22_0602__b28181211451">ObsClient.createPostSignature</strong>, and <strong id="obs_22_0602__b118187218517">ObsClient.createSignedUrl</strong>, <strong id="obs_22_0602__b48182211959">BucketClient</strong> implements the same APIs as <strong id="obs_22_0602__b1981815213514">ObsClient</strong>, including the same functions and parameters, with the <strong id="obs_22_0602__b681852112518">bucketName</strong> parameter omitted.</p>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0602__section14271631164212"><h4 class="sectiontitle">Method</h4><pre class="screen" id="obs_22_0602__screen30860292192113">obsClient.bucketClient(
|
||||
bucketName='*** Your Bucket Name ***'
|
||||
)</pre>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0602__section921406132"><h4 class="sectiontitle">Constructor Parameter Description</h4>
|
||||
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_22_0602__table14455523" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_22_0602__row3095993"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.3.2.1.5.1.1"><p id="obs_22_0602__p49448848"><strong id="obs_22_0602__b7630711132">Parameter</strong></p>
|
||||
</th>
|
||||
<th align="left" class="cellrowborder" valign="top" width="14.099999999999998%" id="mcps1.3.3.2.1.5.1.2"><p id="obs_22_0602__p45933772"><strong id="obs_22_0602__b17310175111222">Type</strong></p>
|
||||
</th>
|
||||
<th align="left" class="cellrowborder" valign="top" width="11.459999999999999%" id="mcps1.3.3.2.1.5.1.3"><p id="obs_22_0602__p29648085"><strong id="obs_22_0602__b1398195425914">Mandatory (Yes/No)</strong></p>
|
||||
</th>
|
||||
<th align="left" class="cellrowborder" valign="top" width="49.44%" id="mcps1.3.3.2.1.5.1.4"><p id="obs_22_0602__p52684690"><strong id="obs_22_0602__b1631113513221">Description</strong></p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="obs_22_0602__row17455632"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.1.5.1.1 "><p id="obs_22_0602__p4620049">bucket_name</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="14.099999999999998%" headers="mcps1.3.3.2.1.5.1.2 "><p id="obs_22_0602__p38679683">str</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="11.459999999999999%" headers="mcps1.3.3.2.1.5.1.3 "><p id="obs_22_0602__p46046605">Yes</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="49.44%" headers="mcps1.3.3.2.1.5.1.4 "><p id="obs_22_0602__p38787544">Name of the bucket client to be created</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="obs_22_0602__section10495806"><h4 class="sectiontitle">Code Examples</h4><pre class="screen" id="obs_22_0602__screen38522714154455"># Import the module.
|
||||
from obs import ObsClient
|
||||
|
||||
# Obtain an AK and SK pair using environment variables or import the AK and SK pair in other ways. Using hard coding may result in leakage.
|
||||
# Obtain an AK and SK pair on the management console.
|
||||
ak = os.getenv("AccessKeyID")
|
||||
sk = os.getenv("SecretAccessKey")
|
||||
# (Optional) If you use a temporary AK and SK pair and a security token to access OBS, obtain them from environment variables.
|
||||
security_token = os.getenv("SecurityToken")
|
||||
# Set <strong id="obs_22_0602__b37966228522842">server</strong> to the endpoint of the region where the bucket is located.
|
||||
server = "https://your-endpoint"
|
||||
|
||||
# Create an obsClient instance.
|
||||
# If you use a temporary AK and SK pair and a security token to access OBS, you must specify <strong id="obs_22_0602__b61979559622924">security_token</strong> when creating an instance.
|
||||
obsClient = ObsClient(access_key_id=ak, secret_access_key=sk, server=server)
|
||||
|
||||
# Create an instance of BucketClient.
|
||||
bucketClient = obsClient.bucketClient('bucketname')
|
||||
# Create a Bucket.
|
||||
resp = bucketClient.createBucket()
|
||||
if resp.status < 300:
|
||||
print('requestId:', resp.requestId)
|
||||
else:
|
||||
print('errorCode:', resp.errorCode)
|
||||
print('errorMessage:', resp.errorMessage)</pre>
|
||||
<div class="note" id="obs_22_0602__note426542817483"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_22_0602__p940712240444">Except for <strong id="obs_22_0602__b4360153171110">ObsClient.listBuckets</strong>, <strong id="obs_22_0602__b9640173931012">ObsClient.downloadFile</strong>, <strong id="obs_22_0602__b126291869118">Obsclient.uploadFile</strong>, <strong id="obs_22_0602__b336019534116">ObsClient.createPostSignature</strong>, and <strong id="obs_22_0602__b1436118532114">ObsClient.createSignedUrl</strong>, <strong id="obs_22_0602__b136125391113">BucketClient</strong> can implement the same APIs as <strong id="obs_22_0602__b18361195313117">ObsClient</strong>, including the same functions and parameters, with the <strong id="obs_22_0602__b15362195301119">bucketName</strong> parameter omitted.</p>
|
||||
</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="familylinks">
|
||||
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_22_0600.html">Initialization (SDK for Python)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
137
docs/obs_3rd_party/python_sdk/obs_22_0603.html
vendored
Normal file
137
docs/obs_3rd_party/python_sdk/obs_22_0603.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
154
docs/obs_3rd_party/python_sdk/obs_22_0604.html
vendored
Normal file
154
docs/obs_3rd_party/python_sdk/obs_22_0604.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
77
docs/obs_3rd_party/python_sdk/obs_22_0800.html
vendored
Normal file
77
docs/obs_3rd_party/python_sdk/obs_22_0800.html
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
<a name="obs_22_0800"></a><a name="obs_22_0800"></a>
|
||||
|
||||
<h1 class="topictitle1">Bucket-Related APIs (SDK for Python)</h1>
|
||||
<div id="body66418347"></div>
|
||||
<div>
|
||||
<ul class="ullinks">
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0801.html">Creating a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0802.html">Obtaining a Bucket List (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0803.html">Checking Whether a Bucket Exists (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0804.html">Deleting a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0805.html">Listing Objects in a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0806.html">Listing Object Versions in a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0807.html">Obtaining Bucket Metadata (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0808.html">Obtaining the Region of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0809.html">Obtaining Storage Information of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0810.html">Configuring a Storage Quota (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0811.html">Obtaining a Bucket Storage Quota (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0812.html">Configuring a Storage Class for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0813.html">Obtaining the Storage Class of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0814.html">Configuring a Bucket ACL (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0815.html">Obtaining a Bucket ACL (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0816.html">Configuring Logging for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0817.html">Obtaining the Logging Configuration of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0818.html">Configuring a Bucket Policy (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0819.html">Obtaining the Policy of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0820.html">Deleting a Bucket Policy (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0821.html">Configuring Lifecycle Rules for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0822.html">Obtaining the Lifecycle Configuration of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0823.html">Deleting the Lifecycle Configuration of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0824.html">Configuring Static Website Hosting for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0825.html">Obtaining Static Website Hosting for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0826.html">Deleting Static Website Hosting for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0827.html">Configuring Versioning for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0828.html">Obtaining the Versioning Status of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0829.html">Configuring CORS for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0830.html">Obtaining the CORS Configuration of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0831.html">Deleting the CORS Configuration of a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0834.html">Configuring Tags for a Bucket (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0835.html">Obtaining Bucket Tags (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
<li class="ulchildlink"><strong><a href="obs_22_0836.html">Deleting Bucket Tags (SDK for Python)</a></strong><br>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
569
docs/obs_3rd_party/python_sdk/obs_22_0801.html
vendored
Normal file
569
docs/obs_3rd_party/python_sdk/obs_22_0801.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
420
docs/obs_3rd_party/python_sdk/obs_22_0802.html
vendored
Normal file
420
docs/obs_3rd_party/python_sdk/obs_22_0802.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
266
docs/obs_3rd_party/python_sdk/obs_22_0803.html
vendored
Normal file
266
docs/obs_3rd_party/python_sdk/obs_22_0803.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
259
docs/obs_3rd_party/python_sdk/obs_22_0804.html
vendored
Normal file
259
docs/obs_3rd_party/python_sdk/obs_22_0804.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
776
docs/obs_3rd_party/python_sdk/obs_22_0805.html
vendored
Normal file
776
docs/obs_3rd_party/python_sdk/obs_22_0805.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
912
docs/obs_3rd_party/python_sdk/obs_22_0806.html
vendored
Normal file
912
docs/obs_3rd_party/python_sdk/obs_22_0806.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
490
docs/obs_3rd_party/python_sdk/obs_22_0807.html
vendored
Normal file
490
docs/obs_3rd_party/python_sdk/obs_22_0807.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
299
docs/obs_3rd_party/python_sdk/obs_22_0808.html
vendored
Normal file
299
docs/obs_3rd_party/python_sdk/obs_22_0808.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
312
docs/obs_3rd_party/python_sdk/obs_22_0809.html
vendored
Normal file
312
docs/obs_3rd_party/python_sdk/obs_22_0809.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
279
docs/obs_3rd_party/python_sdk/obs_22_0810.html
vendored
Normal file
279
docs/obs_3rd_party/python_sdk/obs_22_0810.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
300
docs/obs_3rd_party/python_sdk/obs_22_0811.html
vendored
Normal file
300
docs/obs_3rd_party/python_sdk/obs_22_0811.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
314
docs/obs_3rd_party/python_sdk/obs_22_0812.html
vendored
Normal file
314
docs/obs_3rd_party/python_sdk/obs_22_0812.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
332
docs/obs_3rd_party/python_sdk/obs_22_0813.html
vendored
Normal file
332
docs/obs_3rd_party/python_sdk/obs_22_0813.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
677
docs/obs_3rd_party/python_sdk/obs_22_0814.html
vendored
Normal file
677
docs/obs_3rd_party/python_sdk/obs_22_0814.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
569
docs/obs_3rd_party/python_sdk/obs_22_0815.html
vendored
Normal file
569
docs/obs_3rd_party/python_sdk/obs_22_0815.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
556
docs/obs_3rd_party/python_sdk/obs_22_0816.html
vendored
Normal file
556
docs/obs_3rd_party/python_sdk/obs_22_0816.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
532
docs/obs_3rd_party/python_sdk/obs_22_0817.html
vendored
Normal file
532
docs/obs_3rd_party/python_sdk/obs_22_0817.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
278
docs/obs_3rd_party/python_sdk/obs_22_0818.html
vendored
Normal file
278
docs/obs_3rd_party/python_sdk/obs_22_0818.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
303
docs/obs_3rd_party/python_sdk/obs_22_0819.html
vendored
Normal file
303
docs/obs_3rd_party/python_sdk/obs_22_0819.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
260
docs/obs_3rd_party/python_sdk/obs_22_0820.html
vendored
Normal file
260
docs/obs_3rd_party/python_sdk/obs_22_0820.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
734
docs/obs_3rd_party/python_sdk/obs_22_0821.html
vendored
Normal file
734
docs/obs_3rd_party/python_sdk/obs_22_0821.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
764
docs/obs_3rd_party/python_sdk/obs_22_0822.html
vendored
Normal file
764
docs/obs_3rd_party/python_sdk/obs_22_0822.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
259
docs/obs_3rd_party/python_sdk/obs_22_0823.html
vendored
Normal file
259
docs/obs_3rd_party/python_sdk/obs_22_0823.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
638
docs/obs_3rd_party/python_sdk/obs_22_0824.html
vendored
Normal file
638
docs/obs_3rd_party/python_sdk/obs_22_0824.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
634
docs/obs_3rd_party/python_sdk/obs_22_0825.html
vendored
Normal file
634
docs/obs_3rd_party/python_sdk/obs_22_0825.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
262
docs/obs_3rd_party/python_sdk/obs_22_0826.html
vendored
Normal file
262
docs/obs_3rd_party/python_sdk/obs_22_0826.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
276
docs/obs_3rd_party/python_sdk/obs_22_0827.html
vendored
Normal file
276
docs/obs_3rd_party/python_sdk/obs_22_0827.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
281
docs/obs_3rd_party/python_sdk/obs_22_0828.html
vendored
Normal file
281
docs/obs_3rd_party/python_sdk/obs_22_0828.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
396
docs/obs_3rd_party/python_sdk/obs_22_0829.html
vendored
Normal file
396
docs/obs_3rd_party/python_sdk/obs_22_0829.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
400
docs/obs_3rd_party/python_sdk/obs_22_0830.html
vendored
Normal file
400
docs/obs_3rd_party/python_sdk/obs_22_0830.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
261
docs/obs_3rd_party/python_sdk/obs_22_0831.html
vendored
Normal file
261
docs/obs_3rd_party/python_sdk/obs_22_0831.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
352
docs/obs_3rd_party/python_sdk/obs_22_0834.html
vendored
Normal file
352
docs/obs_3rd_party/python_sdk/obs_22_0834.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
358
docs/obs_3rd_party/python_sdk/obs_22_0835.html
vendored
Normal file
358
docs/obs_3rd_party/python_sdk/obs_22_0835.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
259
docs/obs_3rd_party/python_sdk/obs_22_0836.html
vendored
Normal file
259
docs/obs_3rd_party/python_sdk/obs_22_0836.html
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user