本文整理汇总了Python中dropbox.Dropbox.files_search方法的典型用法代码示例。如果您正苦于以下问题:Python Dropbox.files_search方法的具体用法?Python Dropbox.files_search怎么用?Python Dropbox.files_search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dropbox.Dropbox
的用法示例。
在下文中一共展示了Dropbox.files_search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_files
# 需要导入模块: from dropbox import Dropbox [as 别名]
# 或者: from dropbox.Dropbox import files_search [as 别名]
def find_files(year=None, doy=None):
"""Find netcdf files correponding to year and doy on Dropbox."""
from dropbox import Dropbox
from posixpath import join
import os
access_token = os.environ.get('access_token')
dropbox_dir = os.environ.get('dropbox_dir')
client = Dropbox(access_token)
files = [] # Initialize an empty array
f = 'raw_MpalaTower_{year}_{doy:03d}.nc'.format(
year=year, doy=doy)
program_list = DATA_FILES
program_list.remove('unknown')
for this_file in program_list:
file_location = join(dropbox_dir, netcdf_location, this_file)
matches = []
# listdict has a good metadata in it if we ever decide to use it
results = client.files_search(file_location, f, max_results=1)
matches = results.matches
if matches:
match = matches[0]
temp_location = write_temp(
client,
match.metadata.path_display,
this_file,
f
)
this_file = File(
filename=f,
datafile=this_file,
file_location=temp_location,
)
files.append(this_file)
else:
continue
return files