|
@@ -18,22 +18,24 @@ class R2R:
|
|
|
self.auth_enabled = tool_settings.R2R_USERNAME and tool_settings.R2R_PASSWORD
|
|
|
# self.client = R2RAsyncClient(tool_settings.R2R_BASE_URL)
|
|
|
# self.client_sync = R2RClient(tool_settings.R2R_BASE_URL)
|
|
|
- self.client = None
|
|
|
- self.client_sync = None
|
|
|
+ self.client = R2RAsyncClient(tool_settings.R2R_BASE_URL)
|
|
|
+ self.client_sync = R2RClient(tool_settings.R2R_BASE_URL)
|
|
|
|
|
|
def init_sync(self):
|
|
|
if not self.auth_enabled:
|
|
|
return
|
|
|
# if not self.client_sync:
|
|
|
- client_sync = R2RClient(tool_settings.R2R_BASE_URL)
|
|
|
- client_sync.users.login(tool_settings.R2R_USERNAME, tool_settings.R2R_PASSWORD)
|
|
|
+ # client_sync = R2RClient(tool_settings.R2R_BASE_URL)
|
|
|
+ self.client_sync.users.login(
|
|
|
+ tool_settings.R2R_USERNAME, tool_settings.R2R_PASSWORD
|
|
|
+ )
|
|
|
print(
|
|
|
"1111111111111111111111111111111122222vvdgdfdf" + tool_settings.R2R_USERNAME
|
|
|
)
|
|
|
# print(tool_settings.R2R_USERNAME)
|
|
|
# print(tool_settings.R2R_PASSWORD)
|
|
|
- print(client_sync)
|
|
|
- return client_sync
|
|
|
+ print(self.client_sync)
|
|
|
+ return self.client_sync
|
|
|
|
|
|
async def init(self):
|
|
|
if not self.auth_enabled:
|
|
@@ -44,10 +46,12 @@ class R2R:
|
|
|
)
|
|
|
print(tool_settings.R2R_USERNAME)
|
|
|
print(tool_settings.R2R_PASSWORD)
|
|
|
- client = R2RAsyncClient(tool_settings.R2R_BASE_URL)
|
|
|
- await client.users.login(tool_settings.R2R_USERNAME, tool_settings.R2R_PASSWORD)
|
|
|
- print(client.access_token)
|
|
|
- return client
|
|
|
+ # client = R2RAsyncClient(tool_settings.R2R_BASE_URL)
|
|
|
+ await self.client.users.login(
|
|
|
+ tool_settings.R2R_USERNAME, tool_settings.R2R_PASSWORD
|
|
|
+ )
|
|
|
+ print(self.client.access_token)
|
|
|
+ return self.client
|
|
|
|
|
|
async def ingest_file(self, file_path: str, metadata: Optional[dict]):
|
|
|
client = await self._check_login()
|