Skip to content

Commit

Permalink
added DropboxLoaderRemote
Browse files Browse the repository at this point in the history
  • Loading branch information
eleensmathew committed Oct 2, 2024
1 parent 8c8bf87 commit c469652
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions application/parser/remote/dropbox_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from application.parser.remote.base import BaseRemote
from langchain_community.document_loaders import DropboxLoader

class DropboxLoaderRemote(BaseRemote):
def load_data(self, inputs):
data = eval(inputs)
access_token = data.get("access_token")
folder_path = data.get("folder_path", "")
recursive = data.get("recursive", False)


self.loader = DropboxLoader(
access_token=access_token,
folder_path=folder_path,
recursive=recursive,

)
documents = self.loader.load()
print(f"Loaded {len(documents)} documents from Dropbox")
return documents
3 changes: 2 additions & 1 deletion application/parser/remote/remote_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from application.parser.remote.crawler_loader import CrawlerLoader
from application.parser.remote.web_loader import WebLoader
from application.parser.remote.reddit_loader import RedditPostsLoaderRemote

from application.parser.remote.dropbox_loader import DropboxLoaderRemote

class RemoteCreator:
loaders = {
"url": WebLoader,
"sitemap": SitemapLoader,
"crawler": CrawlerLoader,
"reddit": RedditPostsLoaderRemote,
"dropbox" : DropboxLoaderRemote,
}

@classmethod
Expand Down

0 comments on commit c469652

Please sign in to comment.