Skip to content

Commit 49d6f5c

Browse files
committed
Add support for the /meta endpoint
re: http://developer.github.com/v3/meta/
1 parent afae563 commit 49d6f5c

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

github3/github.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,12 @@ def markdown(self, text, mode='', context='', raw=False):
716716
return req.content
717717
return '' # (No coverage)
718718

719+
def meta(self):
720+
"""Returns an array of addresses in CIDR format specifying the
721+
addresses that the incoming service hooks will originate from."""
722+
url = self._build_url('meta')
723+
return self._json(self._get(url), 200)
724+
719725
def octocat(self):
720726
"""Returns an easter egg of the API."""
721727
url = self._build_url('octocat')

tests/json/meta

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"hooks": ["207.97.227.253/32", "50.57.128.197/32", "108.171.174.178/32", "50.57.231.61/32", "54.235.183.49/32", "54.235.183.23/32", "54.235.118.251/32", "54.235.120.57/32", "54.235.120.61/32", "54.235.120.62/32"], "git": ["207.97.227.239/32"]}

tests/test_github.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import github3
22
from mock import patch
33
from tests.utils import (expect, BaseCase, load)
4-
from requests.compat import urlencode
54

65

76
class TestGitHub(BaseCase):
@@ -479,6 +478,13 @@ def test_login(self):
479478
def test_markdown(self):
480479
pass
481480

481+
def test_meta(self):
482+
self.response('meta')
483+
self.get('https://api.github.com/meta')
484+
meta = self.g.meta()
485+
expect(meta).isinstance(dict)
486+
self.mock_assertions()
487+
482488
def test_organization(self):
483489
self.response('org')
484490
self.get('https://api.github.com/orgs/github3py')

0 commit comments

Comments
 (0)