1- ** Getting Started with the OneDrive Python SDK**
1+ # Getting started with the OneDrive SDK for Python
22
33------------------------------------------------------------------------
44[ ![ Build status] ( https://ci.appveyor.com/api/projects/status/x1cjahp817w6r455?svg=true )] ( https://ci.appveyor.com/project/OneDrive/vroom-client-python )
55
6- Installation
7- ============
6+ ## Installation
87
9- To install the OneDrive Python SDK, open a command prompt and type:
8+ Once you've downloaded the OneDrive SDK for Python , open a command prompt and type the following to install it :
109
11- <pre ><code >pip install onedrivesdk
12- </ code ></ pre >
13- Next, include the SDK in your python project by adding
10+ <pre ><code >pip install onedrivesdk</ code ></ pre >
11+
12+ Next, include the SDK in your Python project by adding:
1413
1514<pre ><code >import onedrivesdk</code ></pre >
1615
17- Authentication
18- ==============
16+ ## Authentication
1917
20- To interact with the OneDrive API, you must authenticate. You can use the following code sample to do so.
18+ To interact with the OneDrive API, your app must authenticate. You can use the following code sample to do so.
2119
2220``` python
2321import onedrivesdk
@@ -39,24 +37,21 @@ code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri)
3937client.auth_provider.authenticate(code, redirect_uri, client_secret)
4038```
4139
42- Once you are authenticated, you should have access to the OneDrive API, and
43- can begin making calls using the SDK!
40+ Once your app is authenticated, you should have access to the OneDrive API, and
41+ can begin making calls using the SDK.
4442
45- Examples
46- ========
43+ ## Examples
4744
48- NOTE: All examples assume that the
49- [ Authentication ] ( #authentication ) has already occured .
45+ ** Note: ** All examples assume that your app has already been
46+ [ Authenticated ] ( #authentication ) .
5047
51- Upload an Item
52- --------------
48+ ### Upload an Item
5349
5450``` python
5551returned_item = client.item(drive = " me" , id = " root" ).children[" newfile.txt" ].upload(" ./path_to_file.txt" )
5652```
5753
58- Download an Item
59- ----------------
54+ ### Download an Item
6055
6156``` python
6257root_folder = client.item(drive = " me" , id = " root" ).children.get()
@@ -65,8 +60,7 @@ id_of_file = root_folder[0].id
6560client.item(drive = " me" , id = id_of_file).download(" ./path_to_download_to.txt" )
6661```
6762
68- Add a Folder
69- ------------
63+ ### Add a folder
7064
7165``` python
7266f = onedrivesdk.Folder()
@@ -77,8 +71,7 @@ i.folder = f
7771returned_item = client.item(drive = " me" , id = " root" ).children.add(i)
7872```
7973
80- Copying an Item
81- ---------------
74+ ### Copy an Item
8275
8376``` python
8477from onedrivesdk.item_reference import ItemReference
@@ -95,8 +88,7 @@ copy_operation.poll_until_complete()
9588
9689```
9790
98- Renaming an Item
99- ----------------
91+ ### Rename an Item
10092
10193``` python
10294renamed_item = onedrivesdk.Item()
@@ -106,27 +98,24 @@ renamed_item.id = "youritemtorename!id"
10698new_item = client.item(drive = " me" , id = renamed_item.id).update(renamed_item)
10799```
108100
109- Paging through a Collection
110- ---------------------------
101+ ### Paging through a collection
111102
112103``` python
113- # get the top 3 elements of root, leaving the next page for more elements
104+ # get the top three elements of root, leaving the next page for more elements
114105collection = client.item(drive = " me" , id = " root" ).children.request(top = 3 ).get()
115106
116107# get the first item in the collection
117108item = collection[0 ]
118109
119- # get next page of 3 elements, if none exist, returns None
110+ # get the next page of three elements, if none exist, returns None
120111collection2 = collection.next_page_request.get()
121112```
122113
123- Async operations
124- ----------------
114+ ### Async operations
125115
126- <p >
127- For async operations, you create an asyncio.coroutine which
128- implements asyncio.ascompleted, and execute it with
129- loop.run\_ until\_ complete.
116+ For async operations, you create an ` asyncio.coroutine ` which
117+ implements ` asyncio.ascompleted ` , and execute it with
118+ ` loop.run\_until\_complete ` .
130119
131120``` python
132121import asyncio
0 commit comments