MCPcopy
hub / github.com/gitcoinco/web / get_issue_comments

Function get_issue_comments

app/git/utils.py:442–475  ·  view source on GitHub ↗

Get the comments from issues on a respository. PLEASE NOTE CURRENT LIMITATION OF 100 COMMENTS. Args: owner (str): Owner of the repo repo (str): Name of the repo issue (int): Issue number (optional) Returns: requests.Response: The GitHub comments response

(owner, repo, issue=None, comment_id=None)

Source from the content-addressed store, hash-verified

440
441
442def get_issue_comments(owner, repo, issue=None, comment_id=None):
443 """Get the comments from issues on a respository.
444 PLEASE NOTE CURRENT LIMITATION OF 100 COMMENTS.
445
446 Args:
447 owner (str): Owner of the repo
448 repo (str): Name of the repo
449 issue (int): Issue number (optional)
450
451 Returns:
452 requests.Response: The GitHub comments response.
453 """
454 params = {
455 'sort': 'created',
456 'direction': 'desc',
457 'per_page': 100, # TODO traverse/concat pages: https://developer.github.com/v3/guides/traversing-with-pagination/
458 }
459 if issue:
460 if comment_id:
461 url = f'https://api.github.com/repos/{owner}/{repo}/issues/comments/{comment_id}'
462 else:
463 url = f'https://api.github.com/repos/{owner}/{repo}/issues/{issue}/comments'
464 else:
465 url = f'https://api.github.com/repos/{owner}/{repo}/issues/comments'
466
467 try:
468 response = requests.get(url, auth=_AUTH, headers=HEADERS, params=params)
469 return response.json()
470 except Exception as e:
471 logger.error(
472 "could not get issue comments - Reason: %s - owner: %s repo: %s issue: %s comment_id: %s status code: %s",
473 e, owner, repo, issue, comment_id, response.status_code
474 )
475 return {}
476
477
478def get_issues(owner, repo, page=1, state='open'):

Callers 4

handleMethod · 0.90
fetch_issue_commentsMethod · 0.90

Calls

no outgoing calls

Tested by 2