Download folders/files by name using pythonSDK

Answered
New post

Comments

2 comments

  • RobinDeSchepper

    You can use the Search endpoint or you can search through the names in an item_collection of a folder and go down the path tree that way.

     

    https://developer.box.com/reference#searching-for-content

    https://developer.box.com/docs/search-for-content

    0
    Comment actions Permalink
  • omal

    I tried this method but I didn't get the file information.  Check the code I have used, 

     

    search_term = 'Welcome to Box.pdf'
    type = 'file' # file, folder, or web_link
    limit = 10
    offset = 0

    # Set search config fields
    content = client.search().query(search_term, result_type=type, limit=limit, offset=offset)
    print(content.__dict__)

    Output: 

    {'_session': , '_url': 'https://api.box.com/2.0/search', '_limit': 10, '_fields': None, '_additional_params': {'query': 'Welcome to Box.pdf', 'type': 'file'}, '_return_full_pages': False, '_has_retrieved_all_items': False, '_all_items': None, '_offset': 0}

     

    Item did not get searched. What is the mistake I have done? Please explain.

     

    Thank you in advance.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.