dropbox.mdx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. title: '💾 Dropbox'
  3. ---
  4. To load folders or files from your Dropbox account, configure the `data_type` parameter as `dropbox` and specify the path to the desired file or folder, starting from the root directory of your Dropbox account.
  5. For Dropbox access, an **access token** is required. Obtain this token by visiting [Dropbox Developer Apps](https://www.dropbox.com/developers/apps). There, create a new app and generate an access token for it.
  6. Ensure your app has the following settings activated:
  7. - In the Permissions section, enable `files.content.read` and `files.metadata.read`.
  8. ## Usage
  9. Install the `dropbox` pypi package:
  10. ```bash
  11. pip install dropbox
  12. ```
  13. Following is an example of how to use the dropbox loader:
  14. ```python
  15. import os
  16. from embedchain import App
  17. os.environ["DROPBOX_ACCESS_TOKEN"] = "sl.xxx"
  18. os.environ["OPENAI_API_KEY"] = "sk-xxx"
  19. app = App()
  20. # any path from the root of your dropbox account, you can leave it "" for the root folder
  21. app.add("/test", data_type="dropbox")
  22. print(app.query("Which two celebrities are mentioned here?"))
  23. # The two celebrities mentioned in the given context are Elon Musk and Jeff Bezos.
  24. ```