Python parsing file object

回答済み
新規投稿

コメント

3件のコメント

  • mwiller

     I think the issue might lie in your iteration over the `path_collection` dictionary — you probably only need one for loop, like this:

     

    for pc_entry in entry['path_collection']['entries']:
        box_folderpath = box_folderpath + pc_entry['name']
    0
    コメントアクション パーマリンク
  • chanmar

    Omg that was it! Thank you so much!

     

    Can I ask another question? I notice that when I search_folders it doesn't returns "tags" in the response even though my file has tags on it. Was this dropped from the file object, or am I just reading it correctly?

    0
    コメントアクション パーマリンク
  • mwiller

     According to the API documentation at https://developer.box.com/v2.0/reference#file-object, the `tags` field is not included in the file object response by default — you need to specifically request it from the API using the `fields` query parameter.  Unfortunately, the Python SDK does not currently make it easy to pass that in — we're working on a big update for the SDK which should include full API parity across all endpoints, but it's not ready yet.  In the meantime, you should be able to make the call manually by doing something like this:

     

    params = {
        'fields': 'type,id,tags', # add any other fields you need here
        'query': '.pdf',
        'file_extensions': 'pdf',
    }
    resp = client.make_request('GET', 'https://api.box.com/2.0/search', params=params).json()
    
    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。