From 5a7d7a7d49f6163caec7f0fea15d4515e622ab67 Mon Sep 17 00:00:00 2001 From: user2589 Date: Sun, 11 Oct 2020 10:33:44 -0400 Subject: [PATCH] feat: support for DependencyGraph in graphql API --- stscraper/github.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/stscraper/github.py b/stscraper/github.py index 44e6f48..aa51a17 100644 --- a/stscraper/github.py +++ b/stscraper/github.py @@ -10,6 +10,20 @@ from .base import * import stutils +# This is a list of preview features +# https://developer.github.com/v3/previews/ +# https://developer.github.com/v4/previews +accept_headers = ( + # v3 repository topics + 'application/vnd.github.mercy-preview+json,' + # v3 reactions + 'application/vnd.github.squirrel-girl-preview,' + # project event details + 'application/vnd.github.starfox-preview+json,' + # dependency graph access + 'application/vnd.github.hawkgirl-preview+json' +) + class GitHubAPIToken(APIToken): api_url = 'https://api.github.com/' @@ -25,10 +39,7 @@ def __init__(self, token=None, timeout=None): # mercy-preview: repo topics # squirrel-girl-preview: issue reactions # starfox-preview: issue events - self._headers = { - 'Accept': 'application/vnd.github.mercy-preview+json,' - 'application/vnd.github.squirrel-girl-preview,' - 'application/vnd.github.starfox-preview+json'} + self._headers = {'Accept': accept_headers} if token is not None: self.token = token self._headers['Authorization'] = 'token ' + token