コード例 #1
0
def sort_subscriptions(username, password):
    l = locator.Locator(username)
    url = l.subscriptions_uri(format='json')
    r = requests.get(url, auth=(username, password))
    page = r.content
    jsn = json.loads(page)
    return sorted(jsn, key=sort_by_subscribers)
コード例 #2
0
def subscription(username, password):
    l = locator.Locator(username)
    url = l.subscriptions_uri(format='json')
    r = requests.get(url, auth=(username, password))
    page = r.content
    jsn = json.loads(page)
    return jsn
コード例 #3
0
    def __init__(self, host=mygpoclient.HOST, client_class=json.JsonClient):
        """Creates a new Public API client

        The parameter host is optional and defaults to
        the main webservice.

        The parameter client_class is optional and should
        not need to be changed in normal use cases. If it
        is changed, it should provide the same interface
        as the json.JsonClient class in mygpoclient.
        """
        self._locator = locator.Locator(None, host)
        self._client = client_class(None, None)
コード例 #4
0
ファイル: public.py プロジェクト: kassidywebb/podcat
    def __init__(self, root_url=mygpoclient.ROOT_URL, client_class=json.JsonClient):
        """Creates a new Public API client

        The parameter root_url is optional and defaults to
        the main webservice. It can be either a hostname or
        a full URL (to force https, for instance).

        The parameter client_class is optional and should
        not need to be changed in normal use cases. If it
        is changed, it should provide the same interface
        as the json.JsonClient class in mygpoclient.
        """
        self._locator = locator.Locator(None, root_url)
        self._client = client_class(None, None)
コード例 #5
0
ファイル: simple.py プロジェクト: maxolasersquad/mygpoclient
    def __init__(self, username, password, root_url=mygpoclient.ROOT_URL,
                 client_class=json.JsonClient):
        """Creates a new Simple API client

        Username and password must be specified and are
        the user's login data for the webservice.

        The parameter root_url is optional and defaults to
        the main webservice. It can be either a hostname or
        a full URL (to force https, for instance).

        The parameter client_class is optional and should
        not need to be changed in normal use cases. If it
        is changed, it should provide the same interface
        as the json.JsonClient class in mygpoclient.
        """
        self.username = username
        self.password = password
        self._locator = locator.Locator(username, root_url)
        self._client = client_class(username, password)
コード例 #6
0
ファイル: simple.py プロジェクト: olivx/scripts
    def __init__(self,
                 username,
                 password,
                 host=mygpoclient.HOST,
                 client_class=json.JsonClient):
        """Creates a new Simple API client

        Username and password must be specified and are
        the user's login data for the webservice.

        The parameter host is optional and defaults to
        the main webservice.

        The parameter client_class is optional and should
        not need to be changed in normal use cases. If it
        is changed, it should provide the same interface
        as the json.JsonClient class in mygpoclient.
        """
        self.username = username
        self.password = password
        self._locator = locator.Locator(username, host)
        self._client = client_class(username, password)
コード例 #7
0
 def test_create_with_url(self):
     """Test locator creation with a root URL instead of host"""
     loc = locator.Locator('hello', 'https://gpo.self.hosted/my')
     self.assertEquals(loc.toplist_uri(),
                       'https://gpo.self.hosted/my/toplist/50.opml')
コード例 #8
0
 def setUp(self):
     self.locator = locator.Locator('jane')
コード例 #9
0
 def test_create_with_host(self):
     """Test locator creation with a host"""
     loc = locator.Locator('hello', 'gpo.self.hosted')
     self.assertEquals(loc.toplist_uri(),
                       'http://gpo.self.hosted/toplist/50.opml')
コード例 #10
0
 def test_create_with_url_slash(self):
     """Test locator creation with a root URL ending with a slash"""
     loc = locator.Locator('hello', 'https://gpo.self.hosted/my/')
     self.assertEquals(loc.toplist_uri(),
                       'https://gpo.self.hosted/my/toplist/50.opml')