Skip to content

Commit

Permalink
Add GitHub connector (move-coop#326)
Browse files Browse the repository at this point in the history
* Add GitHub connector

* GitHub connector review updates

- Wraps GitHub 404 exception in custom Parsons error
- Defaults to loading all list items unless a page is specified
- Documentation and test updates
  • Loading branch information
pjsier authored Jul 30, 2020
1 parent 69e2dcf commit 0311caf
Show file tree
Hide file tree
Showing 11 changed files with 990 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/github.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
GitHub
======

`GitHub <https://github.com>`_ is an online tool for software collaboration.

.. note::
API Credentials
- If you have a GitHub account you can use your normal username and password to authenticate with the API.
- You can also use `a personal access token <https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token>`_.

**********
Quickstart
**********

**Get repo data**

.. code-block:: python
from parsons import GitHub
github = GitHub()
# Get repo by its full name (account/name)
parsons_repo = github.get_repo("move-coop/parsons")
**Get repo issues in a ``Table``**

.. code-block:: python
from parsons import GitHub
github = GitHub()
# Get the first page of a repo's issues as a Table
parsons_issues_table = github.list_repo_issues("move-coop/parsons")
**Download the contents of a repo file**

.. code-block:: python
from parsons import GitHub
github = GitHub()
# Download Parsons README.md to local "/tmp/README.md"
parsons_readme_path = github.download_file("move-coop/parsons", "README.md", local_path="/tmp/README.md")
===
API
===
.. autoclass:: parsons.GitHub
:inherited-members:
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Indices and tables
databases
facebook_ads
freshdesk
github
google
hustle
mailchimp
Expand Down
2 changes: 2 additions & 0 deletions parsons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from parsons.action_network.action_network import ActionNetwork
from parsons.pdi.pdi import PDI
from parsons.azure.azure_blob_storage import AzureBlobStorage
from parsons.github.github import GitHub

__all__ = [
'VAN',
Expand Down Expand Up @@ -86,6 +87,7 @@
'ActionNetwork',
'PDI',
'AzureBlobStorage',
'GitHub',
]

# Define the default logging config for Parsons and its submodules. For now the
Expand Down
5 changes: 5 additions & 0 deletions parsons/github/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from parsons.github.github import GitHub

__all__ = [
'GitHub'
]
Loading

0 comments on commit 0311caf

Please sign in to comment.