def test_putSubscriptions_withPodcastDevice(self): self.set_http_response_value('') device = api.PodcastDevice('manatee', 'My Device', 'mobile', 20) self.assertEquals(self.client.put_subscriptions(device, self.ADD), True) self.assert_http_request_count(1) self.assert_(self.has_put_json_data(self.ADD))
def test_initSetsCorrectAttributes(self): device = api.PodcastDevice(DEVICE_ID_1, self.CAPTION, 'mobile', 42) self.assertEquals(device.device_id, DEVICE_ID_1) self.assertEquals(device.caption, self.CAPTION) self.assertEquals(device.type, 'mobile') self.assertEquals(device.subscriptions, 42)
def test_getSubscriptions_withPodcastDevice(self): self.set_http_response_value('[]') device = api.PodcastDevice('manatee', 'My Device', 'mobile', 20) self.assertEquals(self.client.get_subscriptions(device), []) self.assert_http_request_count(1)
from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.template.defaulttags import register ... client = public.PublicClient() username = "******" password = "******" user = api.MygPodderClient(username, password) toplist = client.get_toplist() top_tags_list = client.get_toptags() list = [] subscriptions = [] subscriptions_url = [] device = api.PodcastDevice('top25', 'mydevice', 'desktop', 0) for i in range(25): list.append(toplist[i].__dict__) subscriptions.append(toplist[i].__dict__) subscriptions_url.append(toplist[i].url) user.put_subscriptions(device.device_id, subscriptions_url) def smartSorting(subscriptions): list = [] for podcast in subscriptions: feedlist = feedparser.parse(podcast.get('url')) count = 0 i = 0