@@ -66,17 +66,29 @@ def gh_fetch_url_and_headers(
6666 raise
6767
6868
69+ # def gh_fetch_url(
70+ # url: str,
71+ # *,
72+ # headers: Optional[Dict[str, str]] = None,
73+ # data: Union[Optional[Dict[str, Any]], str] = None,
74+ # method: Optional[str] = None,
75+ # reader: Callable[[Any], Any] = lambda x: x.read(),
76+ # ) -> Any:
77+ # print(f"api return conent: {gh_fetch_url_and_headers(url, headers=headers, data=data, reader=json.load, method=method)}")
78+ # return gh_fetch_url_and_headers(
79+ # url, headers=headers, data=data, reader=json.load, method=method
80+ # )[1]
81+
6982def gh_fetch_url (
7083 url : str ,
7184 * ,
7285 headers : Optional [Dict [str , str ]] = None ,
7386 data : Union [Optional [Dict [str , Any ]], str ] = None ,
7487 method : Optional [str ] = None ,
75- reader : Callable [[Any ], Any ] = lambda x : x . read () ,
88+ reader : Callable [[Any ], Any ] = json . load ,
7689) -> Any :
77- print (f"api return conent: { gh_fetch_url_and_headers (url , headers = headers , data = data , reader = json .load , method = method )} " )
7890 return gh_fetch_url_and_headers (
79- url , headers = headers , data = data , reader = json . load , method = method
91+ url , headers = headers , data = data , reader = reader , method = method
8092 )[1 ]
8193
8294
@@ -168,11 +180,15 @@ def gh_post_commit_comment(
168180 )
169181
170182
183+ # def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:
184+ # print("deleting comment")
185+ # url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"
186+ # print(f"url: {url}")
187+ # gh_fetch_url(url, method="DELETE")
188+
171189def gh_delete_comment (org : str , repo : str , comment_id : int ) -> None :
172- print ("deleting comment" )
173190 url = f"{ GITHUB_API_URL } /repos/{ org } /{ repo } /issues/comments/{ comment_id } "
174- print (f"url: { url } " )
175- gh_fetch_url (url , method = "DELETE" )
191+ gh_fetch_url (url , method = "DELETE" , reader = lambda x : x .read ())
176192
177193
178194def gh_fetch_merge_base (org : str , repo : str , base : str , head : str ) -> str :
0 commit comments