File object in Python SDK

New post



  • jmoldow_box



    Many of the Client methods do not make API calls directly. Client.file(), Client.folder(), etc. are examples of this. Instead, they give you an empty object which is configured to make API calls that are rooted at that object. If I wanted to delete a folder, I could call client.file(my_id).delete(). If I wanted to rename it, I'd call client.file(my_id).rename(). In your case, you just want to GET information, so you should do file = client.file(my_id).get(). After that, you should be able to do file.content_created_at.


    Whereas actually makes the search API call directly, which is why the object you get from there already has the data you want.

    Comment actions Permalink
  • larsenp_lsc

    Thanks. That did the trick. It would be great if the documentation made it a little clearer. Maybe I'm a little thick, but a note or a code sample in the documentation for the file method could make this a lot clearer.

    Comment actions Permalink

Please sign in to leave a comment.