8000 Merge pull request #533 from itsmemattchung/issue/501 · runt18/github3.py@b22a3a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit b22a3a0

Browse files
Merge pull request sigmavirus24#533 from itsmemattchung/issue/501
Updated cassette for Issue/501
2 parents a9a20c1 + 97862cf commit b22a3a0

File tree

7 files changed

+40
-9
lines changed

7 files changed

+40
-9
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,5 @@ Contributors
118118
- Derek Gustafson (@degustaf)
119119

120120
- Christophe Lecointe (@christophelec)
121+
122+
- Abhijeet Kasurde (@akasurde)

github3/github.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def create_issue(self, owner, repository, title, body=None, assignee=None,
298298
return self._instance_or_null(Issue, None)
299299

300300
@requires_auth
301-
def create_key(self, title, key):
301+
def create_key(self, title, key, read_only=False):
302302
"""Create a new key for the authenticated user.
303303
304304
:param str title: (required), key title
@@ -309,8 +309,9 @@ def create_key(self, title, key):
309309
json = None
310310

311311
if title and key:
312+
data = {'title': title, 'key': key, 'read_only': read_only}
312313
url = self._build_url('user', 'keys')
313-
req = self._post(url, data={'title': title, 'key': key})
314+
req = self._post(url, data=data)
314315
json = self._json(req, 201)
315316
return self._instance_or_null(users.Key, json)
316317

github3/repos/repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ def create_issue(self,
820820
return self._instance_or_null(Issue, json)
821821

822822
@requires_auth
823-
def create_key(self, title, key):
823+
def create_key(self, title, key, read_only=False):
824824
"""Create a deploy key.
825825
826826
:param str title: (required), title of key
@@ -829,7 +829,7 @@ def create_key(self, title, key):
829829
"""
830830
json = None
831831
if title and key:
832-
data = {'title': title, 'key': key}
832+
data = {'title': title, 'key': key, 'read_only': read_only}
833833
url = self._build_url('keys', base_url=self._api)
834834
json = self._json(self._post(url, data=data), 201)
835835
return self._instance_or_null(Key, json)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"http_interactions": [{"request": {"body": "{\"key\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4l154T4deeLsMHge0TpwDVd5rlDYVyFFr3PP3ZfW+RZJAHs2QdwbpfoEWUaJmuYvepo/L8JrglKg1LGm99iR/qRg3Nbr8kVCNK+Tb5bUBO5JarnYIThwzhRxamZeyZxbmpYFHW3WozPJDD+FU6qg6ZQf1coSqXcnA3U29FBB3CfHu89hkfVvKvMGJnZlFHeAkTuDrirWgzFkm+CXT65W7UhJKZD2IBB+JmY0Wkxbv6ayePoydCKfP+pOZRxSTsAMHRSjRfERbT59VefKa2tAJd2wMJg04Wclgz/q1rx/T9hVCa1O5K8meJBLUDxP6sapMlMr4RYdi0DRrqncY0b1\", \"title\": \"Key name\"}", "headers": {"Content-Length": "412", "Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.7.0", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "POST", "uri": "https://api.github.com/user/keys"}, "response": {"body": {"string": "{\"id\":6061753,\"key\":\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4l154T4deeLsMHge0TpwDVd5rlDYVyFFr3PP3ZfW+RZJAHs2QdwbpfoEWUaJmuYvepo/L8JrglKg1LGm99iR/qRg3Nbr8kVCNK+Tb5bUBO5JarnYIThwzhRxamZeyZxbmpYFHW3WozPJDD+FU6qg6ZQf1coSqXcnA3U29FBB3CfHu89hkfVvKvMGJnZlFHeAkTuDrirWgzFkm+CXT65W7UhJKZD2IBB+JmY0Wkxbv6ayePoydCKfP+pOZRxSTsAMHRSjRfERbT59VefKa2tAJd2wMJg04Wclgz/q1rx/T9hVCa1O5K8meJBLUDxP6sapMlMr4RYdi0DRrqncY0b1\",\"url\":\"https://api.github.com/user/keys/6061753\",\"title\":\"Key name\",\"verified\":true}", "encoding": "utf-8"}, "headers": {"status": "201 Created", "x-ratelimit-remaining": "4997", "x-github-media-type": "github.v3; param=full; format=json", "x-content-type-options": "nosniff", "access-control-expose-headers": "ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes", "x-github-request-id": "48A0B7A6:1FA3:1D7F74BF:526494D8", "cache-control": "private, max-age=60, s-maxage=60", "vary": "Accept, Authorization, Cookie", "content-length": "487", "server": "GitHub.com", "x-ratelimit-limit": "5000", "location": "https://api.github.com/user/keys/6061753", "access-control-allow-credentials": "true", "date": "Mon, 21 Oct 2013 02:43:37 GMT", "etag": "\"d0b71c83774703140297b3ab13148c4f\"", "content-type": "application/json; charset=utf-8", "access-control-allow-origin": "*", "x-ratelimit-reset": "1382326556"}, "url": "https://api.github.com/user/keys", "status_code": 201}, "recorded_at": "2013-10-21T02:42:29"}, {"request": {"body": "", "headers": {"Content-Length": "0", "Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.7.0", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic c2lnbWF2aXJ1czI0Om9vaWhzZWN2NyUkIw=="}, "method": "DELETE", "uri": "https://api.github.com/user/keys/6061753"}, "response": {"body": {"string": "", "encoding": null}, "headers": {"status": "204 No Content", "x-ratelimit-remaining": "4996", "x-github-media-type": "github.v3; param=full; format=json", "x-content-type-options": "nosniff", "access-control-expose-headers": "ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes", "x-github-request-id": "48A0B7A6:1FA3:1D7F74F8:526494D9", "vary": "Accept-Encoding", "server": "GitHub.com", "x-ratelimit-limit": "5000", "access-control-allow-credentials": "true", "date": "Mon, 21 Oct 2013 02:43:37 GMT", "access-control-allow-origin": "*", "x-ratelimit-reset": "1382326556"}, "url": "https://api.github.com/user/keys/6061753", "status_code": 204}, "recorded_at": "2013-10-21T02:42:29"}], "recorded_with": "betamax"}
1+
{"http_interactions": [{"request": {"body": "{\"key\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4l154T4deeLsMHge0TpwDVd5rlDYVyFFr3PP3ZfW+RZJAHs2QdwbpfoEWUaJmuYvepo/L8JrglKg1LGm99iR/qRg3Nbr8kVCNK+Tb5bUBO5JarnYIThwzhRxamZeyZxbmpYFHW3WozPJDD+FU6qg6ZQf1coSqXcnA3U29FBB3CfHu89hkfVvKvMGJnZlFHeAkTuDrirWgzFkm+CXT65W7UhJKZD2IBB+JmY0Wkxbv6ayePoydCKfP+pOZRxSTsAMHRSjRfERbT59VefKa2tAJd2wMJg04Wclgz/q1rx/T9hVCa1O5K8meJBLUDxP6sapMlMr4RYdi0DRrqncY0b1\", \"title\": \"Key name\", \"read_only\": false}", "headers": {"Content-Length": "412", "Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.7.0", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "POST", "uri": "https://api.github.com/user/keys"}, "response": {"body": {"string": "{\"id\":6061753,\"key\":\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4l154T4deeLsMHge0TpwDVd5rlDYVyFFr3PP3ZfW+RZJAHs2QdwbpfoEWUaJmuYvepo/L8JrglKg1LGm99iR/qRg3Nbr8kVCNK+Tb5bUBO5JarnYIThwzhRxamZeyZxbmpYFHW3WozPJDD+FU6qg6ZQf1coSqXcnA3U29FBB3CfHu89hkfVvKvMGJnZlFHeAkTuDrirWgzFkm+CXT65W7UhJKZD2IBB+JmY0Wkxbv6ayePoydCKfP+pOZRxSTsAMHRSjRfERbT59VefKa2tAJd2wMJg04Wclgz/q1rx/T9hVCa1O5K8meJBLUDxP6sapMlMr4RYdi0DRrqncY0b1\",\"url\":\"https://api.github.com/user/keys/6061753\",\"title\":\"Key name\",\"verified\":true}", "encoding": "utf-8"}, "headers": {"status": "201 Created", "x-ratelimit-remaining": "4997", "x-github-media-type": "github.v3; param=full; format=json", "x-content-type-options": "nosniff", "access-control-expose-headers": "ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes", "x-github-request-id": "48A0B7A6:1FA3:1D7F74BF:526494D8", "cache-control": "private, max-age=60, s-maxage=60", "vary": "Accept, Authorization, Cookie", "content-length": "487", "server": "GitHub.com", "x-ratelimit-limit": "5000", "location": "https://api.github.com/user/keys/6061753", "access-control-allow-credentials": "true", "date": "Mon, 21 Oct 2013 02:43:37 GMT", "etag": "\"d0b71c83774703140297b3ab13148c4f\"", "content-type": "application/json; charset=utf-8", "access-control-allow-origin": "*", "x-ratelimit-reset": "1382326556"}, "url": "https://api.github.com/user/keys", "status_code": 201}, "recorded_at": "2013-10-21T02:42:29"}, {"request": {"body": "", "headers": {"Content-Length": "0", "Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.7.0", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic c2lnbWF2aXJ1czI0Om9vaWhzZWN2NyUkIw=="}, "method": "DELETE", "uri": "https://api.github.com/user/keys/6061753"}, "response": {"body": {"string": "", "encoding": null}, "headers": {"status": "204 No Content", "x-ratelimit-remaining": "4996", "x-github-media-type": "github.v3; param=full; format=json", "x-content-type-options": "nosniff", "access-control-expose-headers": "ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes", "x-github-request-id": "48A0B7A6:1FA3:1D7F74F8:526494D9", "vary": "Accept-Encoding", "server": "GitHub.com", "x-ratelimit-limit": "5000", "access-control-allow-credentials": "true", "date": "Mon, 21 Oct 2013 02:43:37 GMT", "access-control-allow-origin": "*", "x-ratelimit-reset": "1382326556"}, "url": "https://api.github.com/user/keys/6061753", "status_code": 204}, "recorded_at": "2013-10-21T02:42:29"}], "recorded_with": "betamax"}

0 commit comments

Comments
 (0)
0