From a6b842817cdded934e81e81a9c3004d70408704e Mon Sep 17 00:00:00 2001 From: Arne Brodowski Date: Thu, 7 Feb 2013 16:49:50 +0100 Subject: [PATCH 1/4] as of 2013-01-21 all API endpoints are https only. --- pyslideshare2/pyslideshare.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyslideshare2/pyslideshare.py b/pyslideshare2/pyslideshare.py index 29d1ffb..cef2680 100644 --- a/pyslideshare2/pyslideshare.py +++ b/pyslideshare2/pyslideshare.py @@ -32,12 +32,12 @@ API_VERSION = 2 service_url_dict = { - 'slideshow_by_user' : 'http://www.slideshare.net/api/%d/get_slideshow_by_user' % API_VERSION, - 'get_slideshow' : 'http://www.slideshare.net/api/%d/get_slideshow' % API_VERSION, - 'slideshow_by_tag' : 'http://www.slideshare.net/api/%d/get_slideshow_by_tag' % API_VERSION, - 'slideshow_by_group' : 'http://www.slideshare.net/api/%d/get_slideshow_from_group' % API_VERSION, - 'upload_slideshow' : 'http://www.slideshare.net/api/%d/upload_slideshow' % API_VERSION, - 'delete_slideshow' : 'http://www.slideshare.net/api/%d/delete_slideshow' % API_VERSION + 'slideshow_by_user' : 'https://www.slideshare.net/api/%d/get_slideshow_by_user' % API_VERSION, + 'get_slideshow' : 'https://www.slideshare.net/api/%d/get_slideshow' % API_VERSION, + 'slideshow_by_tag' : 'https://www.slideshare.net/api/%d/get_slideshow_by_tag' % API_VERSION, + 'slideshow_by_group' : 'https://www.slideshare.net/api/%d/get_slideshow_from_group' % API_VERSION, + 'upload_slideshow' : 'https://www.slideshare.net/api/%d/upload_slideshow' % API_VERSION, + 'delete_slideshow' : 'https://www.slideshare.net/api/%d/delete_slideshow' % API_VERSION } class Callable: From e280261eeeeff91e81eacde789eb2e0a78345613 Mon Sep 17 00:00:00 2001 From: Arne Brodowski Date: Thu, 7 Feb 2013 16:51:12 +0100 Subject: [PATCH 2/4] updating API endpoint URLs --- pyslideshare2/pyslideshare.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyslideshare2/pyslideshare.py b/pyslideshare2/pyslideshare.py index cef2680..f57b3fc 100644 --- a/pyslideshare2/pyslideshare.py +++ b/pyslideshare2/pyslideshare.py @@ -32,10 +32,10 @@ API_VERSION = 2 service_url_dict = { - 'slideshow_by_user' : 'https://www.slideshare.net/api/%d/get_slideshow_by_user' % API_VERSION, + 'slideshow_by_user' : 'https://www.slideshare.net/api/%d/get_slideshows_by_user' % API_VERSION, 'get_slideshow' : 'https://www.slideshare.net/api/%d/get_slideshow' % API_VERSION, - 'slideshow_by_tag' : 'https://www.slideshare.net/api/%d/get_slideshow_by_tag' % API_VERSION, - 'slideshow_by_group' : 'https://www.slideshare.net/api/%d/get_slideshow_from_group' % API_VERSION, + 'slideshow_by_tag' : 'https://www.slideshare.net/api/%d/get_slideshows_by_tag' % API_VERSION, + 'slideshow_by_group' : 'https://www.slideshare.net/api/%d/get_slideshows_by_group' % API_VERSION, 'upload_slideshow' : 'https://www.slideshare.net/api/%d/upload_slideshow' % API_VERSION, 'delete_slideshow' : 'https://www.slideshare.net/api/%d/delete_slideshow' % API_VERSION } From dfedccf5ddd9c3982731ca879d213f3c25f81dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20M=C3=BChlenschulte?= Date: Sat, 20 Jul 2013 15:38:04 +0200 Subject: [PATCH 3/4] added general search --- pyslideshare2/pyslideshare.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyslideshare2/pyslideshare.py b/pyslideshare2/pyslideshare.py index f57b3fc..9e85028 100644 --- a/pyslideshare2/pyslideshare.py +++ b/pyslideshare2/pyslideshare.py @@ -37,7 +37,8 @@ 'slideshow_by_tag' : 'https://www.slideshare.net/api/%d/get_slideshows_by_tag' % API_VERSION, 'slideshow_by_group' : 'https://www.slideshare.net/api/%d/get_slideshows_by_group' % API_VERSION, 'upload_slideshow' : 'https://www.slideshare.net/api/%d/upload_slideshow' % API_VERSION, - 'delete_slideshow' : 'https://www.slideshare.net/api/%d/delete_slideshow' % API_VERSION + 'delete_slideshow' : 'https://www.slideshare.net/api/%d/delete_slideshow' % API_VERSION, + 'slideshow_search' : 'https://www.slideshare.net/api/%d/search_slideshows' % API_VERSION } class Callable: @@ -323,6 +324,16 @@ def get_slideshow(self, slideshow_id=None, **args): sys.exit(1) return self.make_call('get_slideshow', slideshow_id=str(slideshow_id), **args) + def get_slideshow_by_search(self, search_term=None, offset=None, limit=None): + """ + Requires: search_term + Optional: offset, limit + """ + if not search_term: + print >> sys.stderr, 'A search term is required for this call.' + sys.exit(1) + return self.make_call('slideshow_search', q=search_term, page=offset, order="latest", items_per_page=limit) + def get_slideshow_by_tag(self, tag=None, offset=None, limit=None): """ Method to retrieve a slideshow by tag From 88e1e1b22bda75d6f1605bba01e5912e1a30cb93 Mon Sep 17 00:00:00 2001 From: Nazim Zeeshan Date: Sat, 30 Nov 2013 13:35:37 +0530 Subject: [PATCH 4/4] adds functionality to get slideshow by url --- pyslideshare2/pyslideshare.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pyslideshare2/pyslideshare.py b/pyslideshare2/pyslideshare.py index 9e85028..46dd1f2 100644 --- a/pyslideshare2/pyslideshare.py +++ b/pyslideshare2/pyslideshare.py @@ -183,7 +183,7 @@ def make_auth_call(self, service_url, **args): Simillar to make_call, except this does authentication first. Needed for upload """ params = self.get_ss_params(encode=False, **args) - params['slideshow_srcfile'] = open(args['slideshow_srcfile'], 'rb') + params['slideshow_srcfile'] = open(args['slideshow_srcfile'], 'rb') opener = urllib2.build_opener(MultipartPostHandler) # Use our custom post handler which supports unicode data = opener.open(service_url_dict[service_url], params).read() json = self.parsexml(data) @@ -314,15 +314,18 @@ def get_slideshow_by_user(self, username_for=None,offset=None,limit=None): username_for = self.params['username'] return self.make_call('slideshow_by_user', username_for=username_for, offset=offset, limit=limit) - def get_slideshow(self, slideshow_id=None, **args): + def get_slideshow(self, slideshow_id=None, slideshow_url=None, **args): """ Method to retrieve a slideshow, given an id - Requires: slideshow_id + Requires: slideshow_id or slideshow_url """ - if not slideshow_id: - print >> sys.stderr, 'slideshow_id is needed for this call.' + if not slideshow_id and not slideshow_url: + print >> sys.stderr, 'slideshow_id or slideshow_url is needed for this call.' sys.exit(1) - return self.make_call('get_slideshow', slideshow_id=str(slideshow_id), **args) + if slideshow_id: + return self.make_call('get_slideshow', slideshow_id=str(slideshow_id), **args) + elif slideshow_url: + return self.make_call('get_slideshow', slideshow_url=str(slideshow_url), **args) def get_slideshow_by_search(self, search_term=None, offset=None, limit=None): """