當前位置: 首頁>>代碼示例>>Python>>正文


Python Dropbox.files_list_revisions方法代碼示例

本文整理匯總了Python中dropbox.Dropbox.files_list_revisions方法的典型用法代碼示例。如果您正苦於以下問題:Python Dropbox.files_list_revisions方法的具體用法?Python Dropbox.files_list_revisions怎麽用?Python Dropbox.files_list_revisions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dropbox.Dropbox的用法示例。


在下文中一共展示了Dropbox.files_list_revisions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: revisions

# 需要導入模塊: from dropbox import Dropbox [as 別名]
# 或者: from dropbox.Dropbox import files_list_revisions [as 別名]
def revisions():
    # Shared Link from Dropbox Chooser
    link = request.args["link"]

    # Calling Dropbox API v1
    metadata = requests.post(
        "https://api.dropbox.com/1/metadata/link",
        params={"link": link},
        headers={"Authorization": "Bearer " + str(session["access_token"])},
    ).json()

    # Calling Dropbox API v2
    dbx = Dropbox(session["access_token"])
    entries = dbx.files_list_revisions(metadata["path"]).entries

    return render_template("revisions.html", path=metadata["path"], revisions=entries)
開發者ID:smarx,項目名稱:revision-browser,代碼行數:18,代碼來源:app.py

示例2: revisions

# 需要導入模塊: from dropbox import Dropbox [as 別名]
# 或者: from dropbox.Dropbox import files_list_revisions [as 別名]
def revisions():
	# Shared Link from Dropbox Chooser
	link = request.args['link']

	# Calling Dropbox API v1
	metadata = requests.post('https://api.dropbox.com/1/metadata/link', params={'link': link},
		headers={'Authorization': 'Bearer ' + str(session['access_token'])}).json()

	# Calling Dropbox API v2
	if not metadata.get('path'):
		return redirect(url_for('index'))
	else:
		dbx = Dropbox(session['access_token'])
		entries = sorted(dbx.files_list_revisions(metadata['path']).entries, key=lambda entry: entry.client_modified)
		entries.reverse()
		return render_template('revisions.html', path=metadata['path'], filename=os.path.split(metadata['path'])[1],
			revisions=entries)
開發者ID:Neo20067,項目名稱:revision-browser.app.neo20067-,代碼行數:19,代碼來源:app.py

示例3: process_user

# 需要導入模塊: from dropbox import Dropbox [as 別名]
# 或者: from dropbox.Dropbox import files_list_revisions [as 別名]
def process_user(uid):
    '''Call /delta for the given user ID and process any changes.'''

    # OAuth token for the user
    token = redis_client.hget('tokens', uid)

    # /delta cursor for the user (None the first time)
    cursor = redis_client.hget('cursors', uid)

    dbx = Dropbox(token)
    has_more = True
    trello_client = trello.TrelloClient(TRELLO_API_KEY, token=TRELLO_API_TOKEN)

    while has_more:
        if cursor is None:
            result = dbx.files_list_folder(path='/remote_workspace')
        else:
            result = dbx.files_list_folder_continue(cursor)

        for entry in result.entries:
            # Ignore deleted files, folders, and non-markdown files
            if (isinstance(entry, DeletedMetadata) or isinstance(entry, FolderMetadata)):
                continue

            card = get_card_by_name(trello_client, entry.name.encode('utf-8'))
            
            if(card == False):
                trello_post(trello_client, entry.name.encode('utf-8'))
                continue

            card.set_pos("top")
            card.comment("update! revision: %s" % entry.rev)

            revs = dbx.files_list_revisions(entry.path_lower)
            if(card.list_id == "577db30f129e87073996cc1a" and len(revs.entries) >= 2):
                card.change_list("577db3127b9a95030e956ab8")



        # Update cursor
        cursor = result.cursor
        redis_client.hset('cursors', uid, cursor)

        # Repeat only if there's more to do
        has_more = result.has_more
開發者ID:kkanazaw,項目名稱:mdwebhook,代碼行數:47,代碼來源:app.py


注:本文中的dropbox.Dropbox.files_list_revisions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。