Fetch commits from GitHub's REST API

The following generates a markdown table from the latest commits on the GitHub repository hosting this FastPages site. We're generating the table the "lazy programmer way" - Mr. Mort, 2022.

import requests

r = requests.get("https://api.github.com/repos/safinsingh/fastpages-apcsp/commits")
commits = r.json()

print("| commit name | hash | date & time |")
print("|-------------|------|-------------|")
for commit in commits:
    print("| {} | {} | {} |".format(
        commit["commit"]["message"],
        commit["sha"][0:7],
        commit["commit"]["committer"]["date"]
    ))
| commit name | hash | date & time |
|-------------|------|-------------|
| feat: python lists | 9eafeb2 | 2022-09-02T21:19:33Z |
| customization | 99bd269 | 2022-08-29T07:14:00Z |
| customize index page | 8875f0e | 2022-08-29T07:00:52Z |
| Fix image URLs | 93f40fb | 2022-08-29T06:57:23Z |
| apel, physics, tags | 116e67e | 2022-08-29T06:51:20Z |
| add docx files and vocab | dab640b | 2022-08-29T06:26:32Z |
| bash tool setup | 9c75118 | 2022-08-29T06:05:04Z |
| python quiz | 1060334 | 2022-08-29T04:47:04Z |
| extra info | 7757f39 | 2022-08-22T20:06:07Z |
| feat: add python "hello" post | 27caf1a | 2022-08-18T06:36:02Z |
| feat: create first markdown post & set up local dev w docker-compose | 9ffbfaa | 2022-08-18T06:17:29Z |
| bug: set correct baseurl in settings.ini | 2b7dd20 | 2022-08-18T05:38:52Z |
| set up custom subdomain | 2771bb6 | 2022-08-18T05:37:00Z |
| Merge pull request #1 from safinsingh/fastpages-automated-setup | 76d9ad8 | 2022-08-18T05:33:10Z |
| setup repo | 148a60c | 2022-08-18T05:29:55Z |
| Initial commit | bbd307a | 2022-08-18T05:29:38Z |

Generated table

commit name hash date & time
feat: python lists 9eafeb2 2022-09-02T21:19:33Z
customization 99bd269 2022-08-29T07:14:00Z
customize index page 8875f0e 2022-08-29T07:00:52Z
Fix image URLs 93f40fb 2022-08-29T06:57:23Z
apel, physics, tags 116e67e 2022-08-29T06:51:20Z
add docx files and vocab dab640b 2022-08-29T06:26:32Z
bash tool setup 9c75118 2022-08-29T06:05:04Z
python quiz 1060334 2022-08-29T04:47:04Z
extra info 7757f39 2022-08-22T20:06:07Z
feat: add python "hello" post 27caf1a 2022-08-18T06:36:02Z
feat: create first markdown post & set up local dev w docker-compose 9ffbfaa 2022-08-18T06:17:29Z
bug: set correct baseurl in settings.ini 2b7dd20 2022-08-18T05:38:52Z
set up custom subdomain 2771bb6 2022-08-18T05:37:00Z
Merge pull request #1 from safinsingh/fastpages-automated-setup 76d9ad8 2022-08-18T05:33:10Z
setup repo 148a60c 2022-08-18T05:29:55Z
Initial commit bbd307a 2022-08-18T05:29:38Z

Bonus: current time

The current time (at the time this site was published) is: 2023-05-23T15:58:54-05:00, generated using:

{{ site.time | date_to_xmlschema }}

This code block was rendered using the "raw" attribute, part of the Liquid syntax!