MCPcopy
hub / github.com/mxrch/GHunt / get_file

Method get_file

ghunt/apis/drive.py:42–65  ·  view source on GitHub ↗
(self, as_client: httpx.AsyncClient, file_id: str)

Source from the content-addressed store, hash-verified

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

Callers 1

huntFunction · 0.95

Calls 4

_scrapeMethod · 0.95
DriveFileClass · 0.90
_load_endpointMethod · 0.80
_queryMethod · 0.80

Tested by

no test coverage detected