Repository URL to install this package:
|
Version:
0.32.0 ▾
|
import os
import requests
from django.conf import settings
GITHUB_AUTH_TOKEN = os.environ.get('GITHUB_AUTH_TOKEN')
def get_github_api_url():
"""
Determine the API url for thie github project from the `PROJECT_ROOT`
"""
PROJECT_ROOT = settings.PROJECT_ROOT
project = str(PROJECT_ROOT.name).replace("_", "-")
return "https://api.github.com/repos/docker/{}".format(project)
def create_github_session():
if GITHUB_AUTH_TOKEN is None:
raise ValueError("GITHUB_AUTH_TOKEN is not set.")
s = requests.Session()
s.headers.update({
'Authorization': 'token {}'.format(GITHUB_AUTH_TOKEN),
'Content-type': 'application/json',
})
return s