本文整理匯總了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