Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

github3api

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github3api - pypi Package Compare versions

Comparing version
0.1.0
to
0.1.1
+128
-126
github3api.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: github3api
Version: 0.1.0
Version: 0.1.1
Summary: An advanced REST client for the GitHub API

@@ -11,127 +11,2 @@ Home-page: https://github.com/soda480/github3api

License: Apache License, Version 2.0
Description: [![GitHub Workflow Status](https://github.com/soda480/github3api/workflows/build/badge.svg)](https://github.com/soda480/github3api/actions)
[![Code Coverage](https://codecov.io/gh/soda480/github3api/branch/master/graph/badge.svg)](https://codecov.io/gh/soda480/github3api)
[![Code Grade](https://www.code-inspector.com/project/13337/status/svg)](https://frontend.code-inspector.com/project/13337/dashboard)
[![PyPI version](https://badge.fury.io/py/github3api.svg)](https://badge.fury.io/py/github3api)
# github3api #
An advanced REST client for the GitHub API. It is a subclass of [rest3client](https://pypi.org/project/rest3client/) tailored for the GitHub API with special optional directives for GET requests that can return all pages from an endpoint or return a generator that can be iterated over. By default all requests will be retried if ratelimit request limit is reached.
### Installation ###
```bash
pip install github3api
```
### Example Usage ###
```python
>>> from github3api import GitHubAPI
```
`GitHubAPI` instantiation
```python
# instantiate using no-auth
>>> client = GitHubAPI()
# instantiate using a token
>>> client = GitHubAPI(bearer_token='****************')
```
`GET` request
```python
# GET request - return JSON response
>>> client.get('/rate_limit')['resources']['core']
{'limit': 60, 'remaining': 37, 'reset': 1588898701}
# GET request - return raw resonse
>>> client.get('/rate_limit', raw_response=True)
<Response [200]>
```
`POST` request
```python
>>> client.post('/user/repos', json={'name': 'test-repo1'})['full_name']
'soda480/test-repo1'
>>> client.post('/repos/soda480/test-repo1/labels', json={'name': 'label1', 'color': '#006b75'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`PATCH` request
```python
>>> client.patch('/repos/soda480/test-repo1/labels/label1', json={'description': 'my label'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`DELETE` request
```python
>>> client.delete('/repos/soda480/test-repo1')
```
`GET all` directive - Get all pages from an endpoint and return list containing only matching attributes
```python
for repo in client.get('/user/repos', _get='all', _attributes=['full_name']):
print(repo['full_name'])
```
`GET page` directive - Yield a page from endpoint
```python
for page in client.get('/user/repos', _get='page'):
for repo in page:
print(repo['full_name'])
```
`total` - Get total number of resources at given endpoint
```python
print(client.total('/user/repos'))
6218
```
### Projects using `github3api` ###
* [edgexfoundry/sync-github-labels](https://github.com/edgexfoundry/cd-management/tree/git-label-sync) A script that synchronizes GitHub labels and milestones
* [edgexfoundry/prune-github-tags](https://github.com/edgexfoundry/cd-management/tree/prune-github-tags) A script that prunes GitHub pre-release tags
* [edgexfoundry/create-github-release](https://github.com/edgexfoundry/cd-management/tree/create-github-release) A script to facilitate creation of GitHub releases
* [soda480/prepbadge](https://github.com/soda480/prepbadge) A script that creates multiple pull request workflows to update a target organization repos with badges
* [soda480/github-contributions](https://github.com/soda480/github-contributions) A script to get contribution metrics for all members of a GitHub organization using the GitHub GraphQL API
### Development ###
Ensure the latest version of Docker is installed on your development server. Fork and clone the repository.
Build the Docker image:
```sh
docker image build \
--target build-image \
--build-arg http_proxy \
--build-arg https_proxy \
-t \
github3api:latest .
```
Run the Docker container:
```sh
docker container run \
--rm \
-it \
-e http_proxy \
-e https_proxy \
-v $PWD:/github3api \
github3api:latest \
/bin/sh
```
Execute the build:
```sh
pyb -X
```
NOTE: commands above assume working behind a proxy, if not then the proxy arguments to both the docker build and run commands can be removed.
Platform: UNKNOWN

@@ -152,1 +27,128 @@ Classifier: Development Status :: 4 - Beta

Description-Content-Type: text/markdown
[![GitHub Workflow Status](https://github.com/soda480/github3api/workflows/build/badge.svg)](https://github.com/soda480/github3api/actions)
[![Code Coverage](https://codecov.io/gh/soda480/github3api/branch/master/graph/badge.svg)](https://codecov.io/gh/soda480/github3api)
[![Code Grade](https://www.code-inspector.com/project/13337/status/svg)](https://frontend.code-inspector.com/project/13337/dashboard)
[![PyPI version](https://badge.fury.io/py/github3api.svg)](https://badge.fury.io/py/github3api)
# github3api #
An advanced REST client for the GitHub API. It is a subclass of [rest3client](https://pypi.org/project/rest3client/) tailored for the GitHub API with special optional directives for GET requests that can return all pages from an endpoint or return a generator that can be iterated over. By default all requests will be retried if ratelimit request limit is reached.
### Installation ###
```bash
pip install github3api
```
### Example Usage ###
```python
>>> from github3api import GitHubAPI
```
`GitHubAPI` instantiation
```python
# instantiate using no-auth
>>> client = GitHubAPI()
# instantiate using a token
>>> client = GitHubAPI(bearer_token='****************')
```
`GET` request
```python
# GET request - return JSON response
>>> client.get('/rate_limit')['resources']['core']
{'limit': 60, 'remaining': 37, 'reset': 1588898701}
# GET request - return raw resonse
>>> client.get('/rate_limit', raw_response=True)
<Response [200]>
```
`POST` request
```python
>>> client.post('/user/repos', json={'name': 'test-repo1'})['full_name']
'soda480/test-repo1'
>>> client.post('/repos/soda480/test-repo1/labels', json={'name': 'label1', 'color': '#006b75'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`PATCH` request
```python
>>> client.patch('/repos/soda480/test-repo1/labels/label1', json={'description': 'my label'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`DELETE` request
```python
>>> client.delete('/repos/soda480/test-repo1')
```
`GET all` directive - Get all pages from an endpoint and return list containing only matching attributes
```python
for repo in client.get('/user/repos', _get='all', _attributes=['full_name']):
print(repo['full_name'])
```
`GET page` directive - Yield a page from endpoint
```python
for page in client.get('/user/repos', _get='page'):
for repo in page:
print(repo['full_name'])
```
`total` - Get total number of resources at given endpoint
```python
print(client.total('/user/repos'))
6218
```
### Projects using `github3api` ###
* [edgexfoundry/sync-github-labels](https://github.com/edgexfoundry/cd-management/tree/git-label-sync) A script that synchronizes GitHub labels and milestones
* [edgexfoundry/prune-github-tags](https://github.com/edgexfoundry/cd-management/tree/prune-github-tags) A script that prunes GitHub pre-release tags
* [edgexfoundry/create-github-release](https://github.com/edgexfoundry/cd-management/tree/create-github-release) A script to facilitate creation of GitHub releases
* [soda480/prepbadge](https://github.com/soda480/prepbadge) A script that creates multiple pull request workflows to update a target organization repos with badges
* [soda480/github-contributions](https://github.com/soda480/github-contributions) A script to get contribution metrics for all members of a GitHub organization using the GitHub GraphQL API
### Development ###
Ensure the latest version of Docker is installed on your development server. Fork and clone the repository.
Build the Docker image:
```sh
docker image build \
--target build-image \
--build-arg http_proxy \
--build-arg https_proxy \
-t \
github3api:latest .
```
Run the Docker container:
```sh
docker container run \
--rm \
-it \
-e http_proxy \
-e https_proxy \
-v $PWD:/github3api \
github3api:latest \
/bin/sh
```
Execute the build:
```sh
pyb -X
```
NOTE: commands above assume working behind a proxy, if not then the proxy arguments to both the docker build and run commands can be removed.

@@ -120,2 +120,8 @@

# logger.debug(f'get total number of resources at endpoint {endpoint}')
if 'per_page' in endpoint:
raise ValueError(f'endpoint {endpoint} with per_page argument is not supported')
if '?' in endpoint:
endpoint = f'{endpoint}&per_page=1'
else:
endpoint = f'{endpoint}?per_page=1'
response = self.get(endpoint, raw_response=True)

@@ -122,0 +128,0 @@ if response.links:

+128
-126
Metadata-Version: 2.1
Name: github3api
Version: 0.1.0
Version: 0.1.1
Summary: An advanced REST client for the GitHub API

@@ -11,127 +11,2 @@ Home-page: https://github.com/soda480/github3api

License: Apache License, Version 2.0
Description: [![GitHub Workflow Status](https://github.com/soda480/github3api/workflows/build/badge.svg)](https://github.com/soda480/github3api/actions)
[![Code Coverage](https://codecov.io/gh/soda480/github3api/branch/master/graph/badge.svg)](https://codecov.io/gh/soda480/github3api)
[![Code Grade](https://www.code-inspector.com/project/13337/status/svg)](https://frontend.code-inspector.com/project/13337/dashboard)
[![PyPI version](https://badge.fury.io/py/github3api.svg)](https://badge.fury.io/py/github3api)
# github3api #
An advanced REST client for the GitHub API. It is a subclass of [rest3client](https://pypi.org/project/rest3client/) tailored for the GitHub API with special optional directives for GET requests that can return all pages from an endpoint or return a generator that can be iterated over. By default all requests will be retried if ratelimit request limit is reached.
### Installation ###
```bash
pip install github3api
```
### Example Usage ###
```python
>>> from github3api import GitHubAPI
```
`GitHubAPI` instantiation
```python
# instantiate using no-auth
>>> client = GitHubAPI()
# instantiate using a token
>>> client = GitHubAPI(bearer_token='****************')
```
`GET` request
```python
# GET request - return JSON response
>>> client.get('/rate_limit')['resources']['core']
{'limit': 60, 'remaining': 37, 'reset': 1588898701}
# GET request - return raw resonse
>>> client.get('/rate_limit', raw_response=True)
<Response [200]>
```
`POST` request
```python
>>> client.post('/user/repos', json={'name': 'test-repo1'})['full_name']
'soda480/test-repo1'
>>> client.post('/repos/soda480/test-repo1/labels', json={'name': 'label1', 'color': '#006b75'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`PATCH` request
```python
>>> client.patch('/repos/soda480/test-repo1/labels/label1', json={'description': 'my label'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`DELETE` request
```python
>>> client.delete('/repos/soda480/test-repo1')
```
`GET all` directive - Get all pages from an endpoint and return list containing only matching attributes
```python
for repo in client.get('/user/repos', _get='all', _attributes=['full_name']):
print(repo['full_name'])
```
`GET page` directive - Yield a page from endpoint
```python
for page in client.get('/user/repos', _get='page'):
for repo in page:
print(repo['full_name'])
```
`total` - Get total number of resources at given endpoint
```python
print(client.total('/user/repos'))
6218
```
### Projects using `github3api` ###
* [edgexfoundry/sync-github-labels](https://github.com/edgexfoundry/cd-management/tree/git-label-sync) A script that synchronizes GitHub labels and milestones
* [edgexfoundry/prune-github-tags](https://github.com/edgexfoundry/cd-management/tree/prune-github-tags) A script that prunes GitHub pre-release tags
* [edgexfoundry/create-github-release](https://github.com/edgexfoundry/cd-management/tree/create-github-release) A script to facilitate creation of GitHub releases
* [soda480/prepbadge](https://github.com/soda480/prepbadge) A script that creates multiple pull request workflows to update a target organization repos with badges
* [soda480/github-contributions](https://github.com/soda480/github-contributions) A script to get contribution metrics for all members of a GitHub organization using the GitHub GraphQL API
### Development ###
Ensure the latest version of Docker is installed on your development server. Fork and clone the repository.
Build the Docker image:
```sh
docker image build \
--target build-image \
--build-arg http_proxy \
--build-arg https_proxy \
-t \
github3api:latest .
```
Run the Docker container:
```sh
docker container run \
--rm \
-it \
-e http_proxy \
-e https_proxy \
-v $PWD:/github3api \
github3api:latest \
/bin/sh
```
Execute the build:
```sh
pyb -X
```
NOTE: commands above assume working behind a proxy, if not then the proxy arguments to both the docker build and run commands can be removed.
Platform: UNKNOWN

@@ -152,1 +27,128 @@ Classifier: Development Status :: 4 - Beta

Description-Content-Type: text/markdown
[![GitHub Workflow Status](https://github.com/soda480/github3api/workflows/build/badge.svg)](https://github.com/soda480/github3api/actions)
[![Code Coverage](https://codecov.io/gh/soda480/github3api/branch/master/graph/badge.svg)](https://codecov.io/gh/soda480/github3api)
[![Code Grade](https://www.code-inspector.com/project/13337/status/svg)](https://frontend.code-inspector.com/project/13337/dashboard)
[![PyPI version](https://badge.fury.io/py/github3api.svg)](https://badge.fury.io/py/github3api)
# github3api #
An advanced REST client for the GitHub API. It is a subclass of [rest3client](https://pypi.org/project/rest3client/) tailored for the GitHub API with special optional directives for GET requests that can return all pages from an endpoint or return a generator that can be iterated over. By default all requests will be retried if ratelimit request limit is reached.
### Installation ###
```bash
pip install github3api
```
### Example Usage ###
```python
>>> from github3api import GitHubAPI
```
`GitHubAPI` instantiation
```python
# instantiate using no-auth
>>> client = GitHubAPI()
# instantiate using a token
>>> client = GitHubAPI(bearer_token='****************')
```
`GET` request
```python
# GET request - return JSON response
>>> client.get('/rate_limit')['resources']['core']
{'limit': 60, 'remaining': 37, 'reset': 1588898701}
# GET request - return raw resonse
>>> client.get('/rate_limit', raw_response=True)
<Response [200]>
```
`POST` request
```python
>>> client.post('/user/repos', json={'name': 'test-repo1'})['full_name']
'soda480/test-repo1'
>>> client.post('/repos/soda480/test-repo1/labels', json={'name': 'label1', 'color': '#006b75'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`PATCH` request
```python
>>> client.patch('/repos/soda480/test-repo1/labels/label1', json={'description': 'my label'})['url']
'https://api.github.com/repos/soda480/test-repo1/labels/label1'
```
`DELETE` request
```python
>>> client.delete('/repos/soda480/test-repo1')
```
`GET all` directive - Get all pages from an endpoint and return list containing only matching attributes
```python
for repo in client.get('/user/repos', _get='all', _attributes=['full_name']):
print(repo['full_name'])
```
`GET page` directive - Yield a page from endpoint
```python
for page in client.get('/user/repos', _get='page'):
for repo in page:
print(repo['full_name'])
```
`total` - Get total number of resources at given endpoint
```python
print(client.total('/user/repos'))
6218
```
### Projects using `github3api` ###
* [edgexfoundry/sync-github-labels](https://github.com/edgexfoundry/cd-management/tree/git-label-sync) A script that synchronizes GitHub labels and milestones
* [edgexfoundry/prune-github-tags](https://github.com/edgexfoundry/cd-management/tree/prune-github-tags) A script that prunes GitHub pre-release tags
* [edgexfoundry/create-github-release](https://github.com/edgexfoundry/cd-management/tree/create-github-release) A script to facilitate creation of GitHub releases
* [soda480/prepbadge](https://github.com/soda480/prepbadge) A script that creates multiple pull request workflows to update a target organization repos with badges
* [soda480/github-contributions](https://github.com/soda480/github-contributions) A script to get contribution metrics for all members of a GitHub organization using the GitHub GraphQL API
### Development ###
Ensure the latest version of Docker is installed on your development server. Fork and clone the repository.
Build the Docker image:
```sh
docker image build \
--target build-image \
--build-arg http_proxy \
--build-arg https_proxy \
-t \
github3api:latest .
```
Run the Docker container:
```sh
docker container run \
--rm \
-it \
-e http_proxy \
-e https_proxy \
-v $PWD:/github3api \
github3api:latest \
/bin/sh
```
Execute the build:
```sh
pyb -X
```
NOTE: commands above assume working behind a proxy, if not then the proxy arguments to both the docker build and run commands can be removed.

@@ -24,3 +24,3 @@ #!/usr/bin/env python

name = 'github3api',
version = '0.1.0',
version = '0.1.1',
description = 'An advanced REST client for the GitHub API',

@@ -27,0 +27,0 @@ long_description = "[![GitHub Workflow Status](https://github.com/soda480/github3api/workflows/build/badge.svg)](https://github.com/soda480/github3api/actions)\n[![Code Coverage](https://codecov.io/gh/soda480/github3api/branch/master/graph/badge.svg)](https://codecov.io/gh/soda480/github3api)\n[![Code Grade](https://www.code-inspector.com/project/13337/status/svg)](https://frontend.code-inspector.com/project/13337/dashboard)\n[![PyPI version](https://badge.fury.io/py/github3api.svg)](https://badge.fury.io/py/github3api)\n\n# github3api #\nAn advanced REST client for the GitHub API. It is a subclass of [rest3client](https://pypi.org/project/rest3client/) tailored for the GitHub API with special optional directives for GET requests that can return all pages from an endpoint or return a generator that can be iterated over. By default all requests will be retried if ratelimit request limit is reached.\n\n\n### Installation ###\n```bash\npip install github3api\n```\n\n### Example Usage ###\n\n```python\n>>> from github3api import GitHubAPI\n```\n\n`GitHubAPI` instantiation\n```python\n# instantiate using no-auth\n>>> client = GitHubAPI()\n\n# instantiate using a token\n>>> client = GitHubAPI(bearer_token='****************')\n```\n\n`GET` request\n```python\n# GET request - return JSON response\n>>> client.get('/rate_limit')['resources']['core']\n{'limit': 60, 'remaining': 37, 'reset': 1588898701}\n\n# GET request - return raw resonse\n>>> client.get('/rate_limit', raw_response=True)\n<Response [200]>\n```\n\n`POST` request\n```python\n>>> client.post('/user/repos', json={'name': 'test-repo1'})['full_name']\n'soda480/test-repo1'\n\n>>> client.post('/repos/soda480/test-repo1/labels', json={'name': 'label1', 'color': '#006b75'})['url']\n'https://api.github.com/repos/soda480/test-repo1/labels/label1'\n```\n\n`PATCH` request\n```python\n>>> client.patch('/repos/soda480/test-repo1/labels/label1', json={'description': 'my label'})['url']\n'https://api.github.com/repos/soda480/test-repo1/labels/label1'\n```\n\n`DELETE` request\n```python \n>>> client.delete('/repos/soda480/test-repo1')\n```\n\n`GET all` directive - Get all pages from an endpoint and return list containing only matching attributes\n```python\nfor repo in client.get('/user/repos', _get='all', _attributes=['full_name']):\n print(repo['full_name'])\n```\n\n`GET page` directive - Yield a page from endpoint\n```python\nfor page in client.get('/user/repos', _get='page'):\n for repo in page:\n print(repo['full_name'])\n```\n\n`total` - Get total number of resources at given endpoint\n```python\nprint(client.total('/user/repos'))\n6218\n```\n\n### Projects using `github3api` ###\n\n* [edgexfoundry/sync-github-labels](https://github.com/edgexfoundry/cd-management/tree/git-label-sync) A script that synchronizes GitHub labels and milestones\n\n* [edgexfoundry/prune-github-tags](https://github.com/edgexfoundry/cd-management/tree/prune-github-tags) A script that prunes GitHub pre-release tags\n\n* [edgexfoundry/create-github-release](https://github.com/edgexfoundry/cd-management/tree/create-github-release) A script to facilitate creation of GitHub releases\n\n* [soda480/prepbadge](https://github.com/soda480/prepbadge) A script that creates multiple pull request workflows to update a target organization repos with badges\n\n* [soda480/github-contributions](https://github.com/soda480/github-contributions) A script to get contribution metrics for all members of a GitHub organization using the GitHub GraphQL API\n\n\n### Development ###\n\nEnsure the latest version of Docker is installed on your development server. Fork and clone the repository.\n\nBuild the Docker image:\n```sh\ndocker image build \\\n--target build-image \\\n--build-arg http_proxy \\\n--build-arg https_proxy \\\n-t \\\ngithub3api:latest .\n```\n\nRun the Docker container:\n```sh\ndocker container run \\\n--rm \\\n-it \\\n-e http_proxy \\\n-e https_proxy \\\n-v $PWD:/github3api \\\ngithub3api:latest \\\n/bin/sh\n```\n\nExecute the build:\n```sh\npyb -X\n```\n\nNOTE: commands above assume working behind a proxy, if not then the proxy arguments to both the docker build and run commands can be removed.\n",