(self, as_client: httpx.AsyncClient, file_id: str)
| 40 | self._load_api(creds, headers) |
| 41 | |
| 42 | async def get_file(self, as_client: httpx.AsyncClient, file_id: str) -> Tuple[bool, DriveFile]: |
| 43 | endpoint_name = inspect.currentframe().f_code.co_name |
| 44 | |
| 45 | verb = "GET" |
| 46 | base_url = f"/drive/v2internal/files/{file_id}" |
| 47 | data_type = None # json, data or None |
| 48 | |
| 49 | params = { |
| 50 | "fields": ','.join(drive_knowledge.request_fields), |
| 51 | "supportsAllDrives": True |
| 52 | } |
| 53 | |
| 54 | self._load_endpoint(endpoint_name) |
| 55 | req = await self._query(as_client, verb, endpoint_name, base_url, params, None, data_type) |
| 56 | |
| 57 | # Parsing |
| 58 | data = json.loads(req.text) |
| 59 | drive_file = DriveFile() |
| 60 | if "error" in data: |
| 61 | return False, drive_file |
| 62 | |
| 63 | drive_file._scrape(data) |
| 64 | |
| 65 | return True, drive_file |
| 66 | |
| 67 | async def get_comments(self, as_client: httpx.AsyncClient, file_id: str, page_token: str="") -> Tuple[bool, str, DriveCommentList]: |
| 68 | endpoint_name = inspect.currentframe().f_code.co_name |
no test coverage detected