mirror of
https://github.com/khornberg/octokit.py
synced 2026-05-17 00:06:59 +03:00
Feature: Use route data
Data is updated from @octokit/routes -> npm -> octokitpy-routes -> pypi
This commit is contained in:
@@ -9,6 +9,7 @@ import requests
|
||||
from jose import jwt
|
||||
from octokit import errors
|
||||
from octokit import utils
|
||||
from routes import specifications
|
||||
|
||||
page_regex = re.compile(r'[\?\&]page=(\d+)[_&=\w\d]*>; rel="(\w+)"')
|
||||
|
||||
@@ -164,7 +165,7 @@ class Octokit(Base):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__()
|
||||
self._create(utils.get_json_data('index.json'))
|
||||
self._create(specifications[kwargs.get('routes', 'api.github.com')])
|
||||
self._setup_authentication(kwargs)
|
||||
self._attribute_cache = defaultdict(dict)
|
||||
|
||||
|
||||
@@ -47,3 +47,12 @@ class TestOctokit(object):
|
||||
assert next(p) == {'page': 2, 'kwargs': {'param': 'value'}}
|
||||
assert next(p) == {'page': 3, 'kwargs': {'param': 'value'}}
|
||||
assert next(p) == {'page': 4, 'kwargs': {'param': 'value'}}
|
||||
|
||||
def test_can_speficy_the_route_specifications_used(self):
|
||||
from octokit import Octokit
|
||||
octokit = Octokit(routes='ghe-2.15')
|
||||
assert '/enterprise/2.15' in octokit.issues.create.__doc__
|
||||
octokit = Octokit()
|
||||
assert '/developer.github.com' in octokit.issues.create.__doc__
|
||||
octokit = Octokit(routes='api.github.com')
|
||||
assert '/developer.github.com' in octokit.issues.create.__doc__
|
||||
|
||||
Reference in New Issue
Block a user