Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello,
I am using the search function in the Dropbox API for Python, and I need to be able to extract the path_lower variable from the SearchV2Result. Hopefully someone can help me with this.
My Code:
dbx.files_search_v2('Test')
Output:
SearchV2Result(cursor=NOT_SET, has_more=False, matches=[SearchMatchV2(highlight_spans=NOT_SET, match_type=SearchMatchTypeV2('filename', None), metadata=MetadataV2('metadata', FolderMetadata(id='id:CMgvcnxDzGAAAAAAAAAAVA', name='Test', parent_shared_folder_id=NOT_SET, path_display='/wyss-predictive-bioanalytics/Yianni/Test', path_lower='/wyss-predictive-bioanalytics/yianni/test', property_groups=NOT_SET, shared_folder_id=NOT_SET, sharing_info=FolderSharingInfo(no_access=False, parent_shared_folder_id='9501352096', read_only=False, shared_folder_id=NOT_SET, traverse_only=False))))])
Again, I would like to extract the path_lower variable, so in this case, it would be '/wyss-predictive-bioanalytics/yianni/test'. Thanks!
The files_search_v2 method returns a SearchV2Result, which has a list of SearchMatchV2 in its 'matches' variable. Each SearchMatchV2 has a MetadataV2 object in its 'metadata' variable, so you can access the Metadata object and its variables, such as 'path_lower', like this:
search_result = dbx.files_search_v2('Test')
for match in search_result.matches:
if match.metadata.is_metadata():
print(match.metadata.get_metadata().path_lower)
else:
# handling for other types here
pass
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!