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

Method get_comments

ghunt/apis/drive.py:67–95  ·  view source on GitHub ↗
(self, as_client: httpx.AsyncClient, file_id: str, page_token: str="")

Source from the content-addressed store, hash-verified

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
69
70 verb = "GET"
71 base_url = f"/drive/v2internal/files/{file_id}/comments"
72 data_type = None # json, data or None
73
74 params = {
75 "supportsAllDrives": True,
76 "maxResults": 100
77 }
78
79 if page_token:
80 params["pageToken"] = page_token
81
82 self._load_endpoint(endpoint_name)
83 req = await self._query(as_client, verb, endpoint_name, base_url, params, None, data_type)
84
85 # Parsing
86 data = json.loads(req.text)
87 drive_comments = DriveCommentList()
88 if "error" in data:
89 return False, "", drive_comments
90
91 next_page_token = data.get("nextPageToken", "")
92
93 drive_comments._scrape(data)
94
95 return True, next_page_token, drive_comments
96
97 async def get_childs(self, as_client: httpx.AsyncClient, file_id: str, page_token: str="") -> Tuple[bool, str, DriveChildList]:
98 endpoint_name = inspect.currentframe().f_code.co_name

Callers 1

huntFunction · 0.95

Calls 4

_scrapeMethod · 0.95
DriveCommentListClass · 0.90
_load_endpointMethod · 0.80
_queryMethod · 0.80

Tested by

no test coverage detected