Pushing data into github and recovering them with Python and pyGithub

This script lets you create a file in your python repository and the retrieve the content of the file.

from credentials import *
from github import Github
import requests
# username = ".....""
# password = "....."

g = Github(username, password)
repo = g.get_user().get_repo("formazione.github.io")
# repo.create_file("memo.txt", "first memo", "We did it")

memo = repo.get_contents("memo.txt")
# print(memo.raw_data)
html = memo.raw_data["_links"]['html']
html = html.replace("https://github.com", "").replace("blob/","")
link = "https://raw.githubusercontent.com" + html

t = requests.get(link)
print(t.text)

Live video coding to create a text in github with python and the get back the content


Subscribe to the newsletter for updates
Tkinter templates
Avatar My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.