Get a specific value of a resource from an endpoint in the GitHub API. Args: github_org (str): The name of the GitHub organization to search. repo (str): The name of the repository to search. endpoint (str):
(
self,
github_org: str,
repo: str,
endpoint: str,
query_params: dict | None = None,
timeout: int | None = None,
)
| 52 | return url |
| 53 | |
| 54 | def get( |
| 55 | self, |
| 56 | github_org: str, |
| 57 | repo: str, |
| 58 | endpoint: str, |
| 59 | query_params: dict | None = None, |
| 60 | timeout: int | None = None, |
| 61 | ): |
| 62 | """Get a specific value of a resource from an endpoint in the GitHub API. |
| 63 | |
| 64 | Args: |
| 65 | github_org (str): |
| 66 | The name of the GitHub organization to search. |
| 67 | repo (str): |
| 68 | The name of the repository to search. |
| 69 | endpoint (str): |
| 70 | The endpoint for the resource. For example, issues/{issue_number}. This means we'd |
| 71 | be making a request to https://api.github.com/repos/{github_org}/{repo}/issues/{issue_number}. |
| 72 | query_params (dict): |
| 73 | A dictionary mapping any query parameters to the desired value. Defaults to None. |
| 74 | timeout (int): |
| 75 | How long to wait before the request times out. Defaults to None. |
| 76 | |
| 77 | Returns: |
| 78 | requests.models.Response |
| 79 | """ |
| 80 | url = self._construct_url(github_org, repo, endpoint) |
| 81 | return requests.get(url, headers=self.headers, params=query_params, timeout=timeout) |
| 82 | |
| 83 | def post(self, github_org: str, repo: str, endpoint: str, payload: dict): |
| 84 | """Post to an endpooint in the GitHub API. |