Created
July 15, 2017 22:23
-
-
Save dodo5522/f91de3687ad21fcac59a1184f67a2bc8 to your computer and use it in GitHub Desktop.
UML diagram to upload a photo into flickr.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' activity diagram | |
@startuml{plantuml_act_flickr_api.png} | |
start | |
:ブラウザを開く; | |
partition ブラウザ操作 { | |
:https://www.flickr.com/services/apps/create/apply\nにアクセスする; | |
if (営利目的か?) then (yes) | |
:APPLY FOR A COMMERCIAL KEY\nボタンを押す; | |
:面倒な質問(事業規模など)\nに回答してsubmitする; | |
else | |
:APPLY FOR A NON-COMMERCIAL KEY\nボタンを押す; | |
:簡単な質問に回答して\nsubmitする; | |
endif | |
:API keyとAPI secret keyが発行される; | |
} | |
:API keyとAPI secret keyをメモする; | |
:Pythonコンソールを開く; | |
partition Python操作 { | |
:FlickrAPIオブジェクト生成; | |
note right | |
flickr = flickrapi.FlickrAPI( | |
api_key, | |
api_secret); | |
end note | |
:有効なトークンを取得済みか確認する; | |
note right | |
flickr.token_valid( | |
perms='write') | |
end note | |
if (有効なトークン?) then (False) | |
:Request Tokenを取得して\nオブジェクトに保持する; | |
note right | |
flickr.get_request_token( | |
oauth_callback='oob') | |
end note | |
:Verifyコード取得用URLを表示する; | |
note right | |
print( | |
flickr.auth_url( | |
perms='write')) | |
end note | |
partition ブラウザ操作 { | |
:Verifyコード取得用URLにアクセスする; | |
:表示されたVerifyコード\nxxx-xxx-xxxをメモする; | |
} | |
:Verifyコードを指定して\nAccess Tokenを取得、\nオブジェクトに保持する; | |
note right | |
flickr.get_access_token( | |
'xxx-xxx-xxx') | |
end note | |
endif | |
:flickr API提供機能を使う; | |
note right | |
flickr.photosets.create( | |
api_key='xxx', | |
title='hoge', | |
primary_photo_id=123) | |
end note | |
} | |
stop | |
@enduml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment