-
Notifications
You must be signed in to change notification settings - Fork 0
PyCGAD Example 2 Upload Download App
Here we will look at a second example application built with Py-CGAD. If you are not familiar with how to setup an application with GitHub please see the documentation located at the Py-CGAD wiki home page.
At this point I'm assuming that you have registered an application with GitHub and you have the App id which can be found on the Application Settings Page.
First make sure Py-CGAD is installed.
We are going to create an application to demonstrate how we can upload and donwload files from a github repository as well as check the contents or a branch on the github repository.
from py_cgad.githubapp import GitHubApp
import os
class UploadDownloadApp(GitHubApp):
def __init__(self, verbosity_in=0):
"""Upload Download app can upload and download files from repo and its wiki."""
if isinstance(verbosity_in, list):
verbosity_in = verbosity_in[0]
super().__init__(
120492,
"UploadDownloadApp",
"JoshuaSBrown",
"PyCGADExample2",
os.path.abspath(__file__),
verbosity=verbosity_in,
)Notice that this example is almost identical to the first example, here we inherit from the GitHubApp class provided by PyCGAD. Our app class is called UploadDownloadApp. We have provided the github app id which you can get by registering an application on GitHub, instructions for how to do this are on the Py-CGAD wiki page here.