Created
May 25, 2022 09:54
-
-
Save kumaraditya303/9b6f76f29e3ac1962320df0c7f9a685a to your computer and use it in GitHub Desktop.
Generate toml data for benchmarks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
import json | |
import toml | |
BASE_URL = "https://api.github.com/repos/python/cpython/pulls?per_page=1000&state=all" | |
def main(): | |
page = 1 | |
all_issues = [] | |
while page <= 10: | |
with urlopen(f"{BASE_URL}&page={page}") as response: | |
issues = json.loads(response.read()) | |
if not issues: | |
break | |
all_issues.extend(issues) | |
print(f"Page: {page} Total Issues: {len(all_issues)}") | |
page +=1 | |
with open("issues.toml", "w") as f: | |
f.write(toml.dumps({"data": all_issues})) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment