diff --git a/docs/api/GetPhoto.markdown b/docs/api/GetPhoto.markdown index 5a6b56d..6fa4d9e 100644 --- a/docs/api/GetPhoto.markdown +++ b/docs/api/GetPhoto.markdown @@ -10,6 +10,7 @@ Get Photo 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -53,6 +54,16 @@ _Authentication: optional_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->get("/photo/b/view.json"); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + photo = client.photos.list()[0] # Returns the first photo from the list + photo.view(returnSizes="20x20") + print(photo.path20x20) + + http://current.openphoto.me/photo/c7/create/baad9/20x20.jpg + ---------------------------------------- @@ -109,8 +120,10 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration [ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/GetPhotoNextPrevious.markdown b/docs/api/GetPhotoNextPrevious.markdown index d5e9207..14e1e6d 100644 --- a/docs/api/GetPhotoNextPrevious.markdown +++ b/docs/api/GetPhotoNextPrevious.markdown @@ -10,6 +10,7 @@ Get Next/Previous Photo 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -53,6 +54,15 @@ _Authentication: optional_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->get("/photo/b/nextprevious.json"); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + photo = client.photos.list()[1] # Returns the second photo in the list + print(photo.next_previous()) + + {'previous': [], 'next': []} + ---------------------------------------- @@ -152,8 +162,10 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration [ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/GetPhotos.markdown b/docs/api/GetPhotos.markdown index 43d1c14..c4defe1 100644 --- a/docs/api/GetPhotos.markdown +++ b/docs/api/GetPhotos.markdown @@ -10,6 +10,7 @@ Get Photos 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -56,6 +57,13 @@ _Authentication: optional_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->get("/photos/list.json", array('tags' => 'sunnyvale')); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + print client.photos.list(tags="sunnyvale") + + [, ] ---------------------------------------- @@ -142,8 +150,10 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration [ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/GetTags.markdown b/docs/api/GetTags.markdown index 0ee243e..5ad48e7 100644 --- a/docs/api/GetTags.markdown +++ b/docs/api/GetTags.markdown @@ -10,6 +10,7 @@ Get Tags 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -50,6 +51,14 @@ _None_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->get("/tags/list.json"); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + print(client.tags.list()) + + [, , ...] + ---------------------------------------- @@ -102,6 +111,8 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/PostPhotoDelete.markdown b/docs/api/PostPhotoDelete.markdown index 7a839c3..c928981 100644 --- a/docs/api/PostPhotoDelete.markdown +++ b/docs/api/PostPhotoDelete.markdown @@ -10,6 +10,7 @@ Delete Photo 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -50,6 +51,13 @@ _None_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->post("/photo/a/delete.json"); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + photo = client.photos.list()[0] # Returns the first photo in the list + photo.delete() + ---------------------------------------- @@ -77,6 +85,8 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/PostPhotoUpdate.markdown b/docs/api/PostPhotoUpdate.markdown index 66c9590..6c738bc 100644 --- a/docs/api/PostPhotoUpdate.markdown +++ b/docs/api/PostPhotoUpdate.markdown @@ -10,6 +10,7 @@ Update Photo 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -61,6 +62,13 @@ _Authentication: required_ $client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret); $response = $client->post("/photo/a/update.json", array('title' => 'My Photo Title', 'tags' => 'sunnyvale,downtown')); + +#### Python (using [openphoto-python][openphoto-python]) + + client = openphoto.OpenPhoto() + photo = client.photos.list()[0] # Returns the first photo in the list + photo.update(title="My Photo Title", tags=["sunnyvale", "downtown"]) + ---------------------------------------- @@ -120,6 +128,8 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python diff --git a/docs/api/PostPhotoUpload.markdown b/docs/api/PostPhotoUpload.markdown index ae00786..ebf6de0 100644 --- a/docs/api/PostPhotoUpload.markdown +++ b/docs/api/PostPhotoUpload.markdown @@ -10,6 +10,7 @@ Upload Photo 1. [Examples][examples] * [Command line][example-cli] * [PHP][example-php] + * [Python][example-python] 1. [Response][response] * [Sample][sample] @@ -75,6 +76,16 @@ _Authentication: required_ $photoBase64Encoded = base64_encode(file_get_contents('/path/to/photo.jpg')); $response = $client->post("/photo/upload.json", array('photo' => $photoBase64Encoded, 'tags' => 'sunnyvale,downtown')); + +#### Python (using [openphoto-python][openphoto-python]) + + # multipart + client = openphoto.OpenPhoto() + client.photo.upload("path/to/photo.jpg", tags=["sunnyvale", "downtown"]) + + # base64 encoded + client.photo.upload_encoded("path/to/photo.jpg", tags=["sunnyvale", "downtown"]) + ---------------------------------------- @@ -134,6 +145,8 @@ The response is in a standard [response envelope](http://theopenphotoproject.org [examples]: #examples [example-cli]: #example-cli [example-php]: #example-php +[example-python]: #example-python [response]: #response [sample]: #sample [openphoto-php]: https://github.com/photo/openphoto-php +[openphoto-python]: https://github.com/photo/openphoto-python