BOXの使い方メモ
Webdavが使える。とりあえずcadaverをインストール。
shared linkの名前はファイル名から(もちろん)推測不可能。
Account settingで"Enable external links to: Nothing, restrict sharing"しておかないと、shareボタンを押すとただちに公開されてしまう。ディレクトリの場合、その以下のファイル全部公開される。
BOX PYTHON APIの使い方メモ
OAuth2が全然わからない。
まず、https://app.box.com/developers/servicesへ行って、create application。client_idとclient_secretはそこに書いてある。developer tokenはボタンを押すと表示される(1時間で無効になる)。python sdkのスクリプトは動く。
from boxsdk import OAuth2 oauth = OAuth2( client_id='hogeid', client_secret='hogesecret', access_token='hogeaccesstoken', )
とすれば、動作のテストはできる。例えば、
from boxsdk import Client client = Client(oauth) root_folder = client.folder(folder_id='0') shared_folder = root_folder.create_subfolder('shared_folder') uploaded_file = shared_folder.upload('/Users/hoge/hogefile') shared_link = shared_folder.get_shared_link()
https://github.com/box/box-python-sdk
参考になりそうなリンク
http://www.quora.com/How-does-OAuth-2-0-work
https://github.com/reddit/reddit/wiki/OAuth2-Python-Example
Download
Downloadするにはfile_idをゲットすればよいのだろうか。
https://developers.box.com/using-the-view-api-with-the-content-api/