mirror of
https://github.com/khornberg/octokit.py
synced 2026-05-18 20:09:06 +03:00
Merge pull request #50 from khornberg/feature/routes
Refactor: Drop python 3.4 support
This commit is contained in:
+4
-3
@@ -1,4 +1,5 @@
|
||||
language: python
|
||||
dist: xenial
|
||||
python:
|
||||
- '3.6'
|
||||
sudo: false
|
||||
@@ -12,15 +13,15 @@ env:
|
||||
- TOXENV=docs
|
||||
matrix:
|
||||
include:
|
||||
- python: '3.7'
|
||||
env:
|
||||
- TOXENV=py37
|
||||
- python: '3.6'
|
||||
env:
|
||||
- TOXENV=py36
|
||||
- python: '3.5'
|
||||
env:
|
||||
- TOXENV=py35
|
||||
- python: '3.4'
|
||||
env:
|
||||
- TOXENV=py34
|
||||
before_install:
|
||||
- python --version
|
||||
- uname -a
|
||||
|
||||
+9
-4
@@ -57,7 +57,7 @@ Python client for GitHub API
|
||||
Installation
|
||||
============
|
||||
|
||||
**requires python 3.4+**
|
||||
**requires python 3.5+**
|
||||
|
||||
Yes that is opinionated. Python 2 is near the end of the life and this is a new project.
|
||||
|
||||
@@ -133,6 +133,11 @@ For applications provide the application id either from the ping webhook or the
|
||||
The :code:`private_key` is a string of your private key provided for the application.
|
||||
The :code:`app` scheme will use the application id and private key to get a token for the first installation id of the application.
|
||||
|
||||
API Schema/Routes/Specifications
|
||||
--------------------------------
|
||||
|
||||
One can instantiate the ``Octokit`` with ``routes=specification`` where the ``specification`` is one of ``api.github.com``, ``ghe-2.15``, etc.
|
||||
|
||||
TODOs
|
||||
===========
|
||||
|
||||
@@ -158,7 +163,7 @@ The :code:`octokit` client based on the available `route data <https://github.co
|
||||
|
||||
::
|
||||
|
||||
[ ] Periodically, check if ``routes.json`` has changed and if so fetch and open a PR for it to be merged
|
||||
[x] Periodically, check if ``routes.json`` has changed and if so fetch and open a PR for it to be merged
|
||||
|
||||
[ ] Periodically, check if ``webhook-names.json`` has changed and if so fetch and open a PR for it to be merged
|
||||
|
||||
@@ -193,7 +198,7 @@ Best Practices
|
||||
|
||||
[ ] handles rate limiting
|
||||
|
||||
[ ] pagination
|
||||
[x] pagination
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
@@ -207,7 +212,7 @@ Deployment
|
||||
|
||||
::
|
||||
|
||||
[ ] Deploy wheels
|
||||
[x] Deploy wheels
|
||||
[ ] Make GitHub releases work
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
python-jose==3.0.1
|
||||
requests==2.21.0
|
||||
octokitpy-routes==0.0.5
|
||||
|
||||
@@ -21,7 +21,7 @@ def read(*names, **kwargs):
|
||||
|
||||
setup(
|
||||
name='octokitpy',
|
||||
version='0.9.2',
|
||||
version='0.10.0',
|
||||
license='MIT license',
|
||||
description='Python client for GitHub API',
|
||||
long_description='%s\n%s' % (
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@ class TestClientMethods(object):
|
||||
pass # ignore non-class attributes
|
||||
|
||||
def test_method_has_doc_string(self):
|
||||
assert Octokit(
|
||||
).oauth_authorizations.list_grants.__doc__ == """You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `[\"repo\", \"user\"]`.""" # noqa E501
|
||||
assert Octokit().oauth_authorizations.list_grants.__doc__ == self.doc_string
|
||||
|
||||
def test_method_has_name_string(self):
|
||||
assert Octokit().oauth_authorizations.list_grants.__name__ == 'list_grants'
|
||||
@@ -261,3 +260,7 @@ class TestClientMethods(object):
|
||||
data=json.dumps(data, sort_keys=True),
|
||||
headers=headers
|
||||
)
|
||||
|
||||
@property
|
||||
def doc_string(self):
|
||||
return """You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `[\"repo\", \"user\"]`.""" # noqa E501
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
[tox]
|
||||
envlist =
|
||||
check,
|
||||
{py36,py35,py34},
|
||||
{py37,py36,py35},
|
||||
docs
|
||||
|
||||
[testenv]
|
||||
basepython =
|
||||
py37: {env:TOXPYTHON:python3.7}
|
||||
py36: {env:TOXPYTHON:python3.6}
|
||||
py35: {env:TOXPYTHON:python3.5}
|
||||
py34: {env:TOXPYTHON:python3.4}
|
||||
{bootstrap,check,docs}: {env:TOXPYTHON:python3}
|
||||
setenv =
|
||||
PYTHONPATH={toxinidir}/tests
|
||||
|
||||
Reference in New Issue
Block a user