mirror of
https://github.com/khornberg/octokit.py
synced 2026-05-20 20:04:47 +03:00
43 lines
1.1 KiB
ReStructuredText
43 lines
1.1 KiB
ReStructuredText
=====
|
|
Usage
|
|
=====
|
|
|
|
To use octokit.py in a project::
|
|
|
|
import octokit
|
|
|
|
Chaining requests
|
|
=================
|
|
|
|
::
|
|
|
|
issue = Octokit().issues.edit(owner='testUser', repo='testRepo', number=1, state='closed')
|
|
# If the previous request had a required url attribute, the next request will use the previous url attribute
|
|
# This does not apply attributes that are part of the body of the request on post, patch, etc.
|
|
issue.pull_requests.create(head='branch', base='master', title='Title')
|
|
# Previous attributes can be overridden
|
|
issue.pull_requests.create(owner='differentOwner', head='branch', base='master', title='Title')
|
|
|
|
Responses
|
|
=========
|
|
|
|
Responses are the Octokit instance with state in ``json`` and ``response``. ``json`` is the result of the Requests ``response.json()``. ``response`` is the json as a python object.
|
|
|
|
|
|
octokit.json
|
|
================
|
|
|
|
::
|
|
|
|
issue = Octokit().issues.get(owner='testUser', repo='testRepo', number=1)
|
|
issue.json['title'] # Title of issue
|
|
|
|
|
|
octokit.response
|
|
================
|
|
|
|
::
|
|
|
|
issue = Octokit().issues.get(owner='testUser', repo='testRepo', number=1)
|
|
issue.response.title # Title of issue
|