当前位置: 首页>>代码示例>>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;未经允许,请勿转载。