:calls: `GET /repos/{owner}/{repo}/contents/{path} `_ :param path: string :param ref: string :rtype: :class:`github.ContentFile.ContentFile` or a list of them
(self, path: str, ref: Opt[str] = NotSet)
| 2453 | return PaginatedList(github.Commit.Commit, self._requester, f"{self.url}/commits", url_parameters) |
| 2454 | |
| 2455 | def get_contents(self, path: str, ref: Opt[str] = NotSet) -> list[ContentFile] | ContentFile: |
| 2456 | """ |
| 2457 | :calls: `GET /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#contents>`_ |
| 2458 | :param path: string |
| 2459 | :param ref: string |
| 2460 | :rtype: :class:`github.ContentFile.ContentFile` or a list of them |
| 2461 | """ |
| 2462 | assert isinstance(path, str), path |
| 2463 | assert is_optional(ref, str), ref |
| 2464 | # Path of '/' should be the empty string. |
| 2465 | if path == "/": |
| 2466 | path = "" |
| 2467 | url_parameters = dict() |
| 2468 | if is_defined(ref): |
| 2469 | url_parameters["ref"] = ref |
| 2470 | headers, data = self._requester.requestJsonAndCheck( |
| 2471 | "GET", |
| 2472 | f"{self.url}/contents/{urllib.parse.quote(path)}", |
| 2473 | parameters=url_parameters, |
| 2474 | follow_302_redirect=True, |
| 2475 | ) |
| 2476 | |
| 2477 | if isinstance(data, list): |
| 2478 | return [ |
| 2479 | # Lazy completion only makes sense for files. See discussion |
| 2480 | # here: https://github.com/jacquev6/PyGithub/issues/140#issuecomment-13481130 |
| 2481 | github.ContentFile.ContentFile(self._requester, headers, item, completed=(item["type"] != "file")) |
| 2482 | for item in data |
| 2483 | ] |
| 2484 | return github.ContentFile.ContentFile(self._requester, headers, data, completed=True) |
| 2485 | |
| 2486 | def get_deployments( |
| 2487 | self, |
no test coverage detected