当前位置: 首页>>代码示例>>Python>>正文


Python util.check_error函数代码示例

本文整理汇总了Python中util.check_error函数的典型用法代码示例。如果您正苦于以下问题:Python check_error函数的具体用法?Python check_error怎么用?Python check_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: find_shows_by_category

 def find_shows_by_category(self, category, genre=None, area=None,
                            release_year=None, paid=None,
                            orderby='view-today-count',
                            streamtypes=None, person=None,
                            page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=62
     """
     url = 'https://openapi.youku.com/v2/shows/by_category.json'
     params = {
         'client_id': self.client_id,
         'category': category,
         'genre': genre,
         'area': area,
         'release_year': release_year,
         'paid': paid,
         'orderby': orderby,
         'streamtypes': streamtypes,
         'person': person,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:25,代码来源:youku_shows.py

示例2: search_videos_by_keyword

 def search_videos_by_keyword(self, keyword, category=None,
                              period='week', orderby='relevance',
                              public_type='all', paid=None,
                              timeless=None, timemore=None,
                              streamtypes=None,
                              page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=81
     """
     url = 'https://openapi.youku.com/v2/searches/video/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'category': category,
         'period': period,
         'orderby': orderby,
         'public_type': public_type,
         'paid': paid,
         'timeless': timeless,
         'timemore': timemore,
         'streamtypes': streamtypes,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:27,代码来源:youku_searches.py

示例3: search_shows_by_keyword

 def search_shows_by_keyword(self, keyword, unite=0, source_site=None,
                             category=None, release_year=None,
                             area=None, orderby='view-count',
                             paid=None, hasvideotype=None,
                             page=1, count=20):
     """doc: http://open.youku.com/docs/doc?id=82
     """
     url = 'https://openapi.youku.com/v2/searches/show/by_keyword.json'
     params = {
         'client_id': self.client_id,
         'keyword': keyword,
         'unite': unite,
         'source_site': source_site,
         'category': category,
         'release_year': release_year,
         'area': area,
         'orderby': orderby,
         'paid': paid,
         'hasvideotype': hasvideotype,
         'page': page,
         'count': count
     }
     params = remove_none_value(params)
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:26,代码来源:youku_searches.py

示例4: comment_expression

 def comment_expression(self):
     """doc: http://open.youku.com/docs/doc?id=92
     """
     url = 'https://openapi.youku.com/v2/schemas/comment/expression.json'
     r = requests.get(url)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:7,代码来源:youku_schemas.py

示例5: create

    def create(self, params):
        # prepare file info
        params['file_name'] = self.file_name
        params['file_size'] = self.file_size
        params['file_md5'] = self.file_md5 = self.checksum_md5file(self.file)
        self.logger.info('upload file %s, size: %d bytes' %
                         (self.file_name, self.file_size))
        self.logger.info('md5 of %s: %s' %
                         (self.file_name, self.file_md5))

        params['client_id'] = self.client_id
        params['access_token'] = self.access_token

        url = 'https://openapi.youku.com/v2/uploads/create.json'
        r = requests.get(url, params=params)
        check_error(r, 201)
        result = r.json()

        self.upload_token = result['upload_token']
        self.logger.info('upload token of %s: %s' %
                         (self.file_name, self.upload_token))

        if result['instant_upload_ok'] == 'yes':
            # pass upload and finish
            # this case hasn't happen and test
            self.logger.info("instant upload %s" % self.file_name)
            return self.commit()

        self.upload_server_ip = socket.gethostbyname(
            result['upload_server_uri'])
        self.logger.info('upload_server_ip of %s: %s' %
                         (self.file_name, self.upload_server_ip))
开发者ID:dassio,项目名称:youtube2youku,代码行数:32,代码来源:youku_upload.py

示例6: playlist_category

 def playlist_category(self):
     """doc: http://open.youku.com/docs/doc?id=94
     """
     url = 'https://openapi.youku.com/v2/schemas/playlist/category.json'
     r = requests.get(url)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:7,代码来源:youku_schemas.py

示例7: searche_top_category

 def searche_top_category(self):
     """doc: http://open.youku.com/docs/doc?id=95
     """
     url = 'https://openapi.youku.com/v2/schemas/searche/top/category.json'
     r = requests.get(url)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:7,代码来源:youku_schemas.py

示例8: upload_spec

 def upload_spec(self):
     """doc: http://open.youku.com/docs/doc?id=91
     """
     url = 'https://openapi.youku.com/v2/schemas/upload/spec.json'
     r = requests.get(url)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:7,代码来源:youku_schemas.py

示例9: check

 def check(self):
     params = {
         'upload_token': self.upload_token
     }
     url = 'http://%s/gupload/check' % self.upload_server_ip
     r = requests.get(url, params=params)
     check_error(r, 200)
     return r.json()
开发者ID:dassio,项目名称:youtube2youku,代码行数:8,代码来源:youku_upload.py

示例10: new_slice

 def new_slice(self):
     params = {
         'upload_token': self.upload_token
     }
     url = 'http://%s/gupload/new_slice' % self.upload_server_ip
     r = requests.get(url, params=params)
     check_error(r, 201)
     self._save_slice_state(r.json())
开发者ID:dassio,项目名称:youtube2youku,代码行数:8,代码来源:youku_upload.py

示例11: my_info

 def my_info(self, access_token):
     """doc: http://open.youku.com/docs/doc?id=23
     """
     url = 'https://openapi.youku.com/v2/users/myinfo.json'
     data = {'client_id': self.client_id,
             'access_token': access_token}
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:9,代码来源:youku_users.py

示例12: new_slice

 def new_slice(self):
     params = {
         'upload_token': self.upload_token
     }
     url = 'http://%s/gupload/new_slice' % self.upload_server_ip
     r = requests.get(url, params=params)
     check_error(r, 200, 201)
     # origin value is 201, but new_slice return status is 200,
     # GoTop 2016.2.9 change 201 to 200
     self._save_slice_state(r.json())
开发者ID:GoTop,项目名称:AutoSystem,代码行数:10,代码来源:youku_upload.py

示例13: refresh_token

 def refresh_token(self, refresh_token):
     '''return origin json'''
     url = 'https://openapi.youku.com/v2/oauth2/token'
     data = {'client_id': self.client_id,
             'client_secret': self.client_secret,
             'grant_type': 'refresh_token',
             'refresh_token': refresh_token}
     r = requests.post(url, data=data)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:10,代码来源:youku_oauth.py

示例14: find_playlist_by_id

 def find_playlist_by_id(self, playlist_id):
     """doc: http://open.youku.com/docs/doc?id=66
     """
     url = 'https://openapi.youku.com/v2/playlists/show.json'
     params = {
         'client_id': self.client_id,
         'playlist_id': playlist_id
     }
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:11,代码来源:youku_playlists.py

示例15: subscribe_notice

 def subscribe_notice(self, access_token):
     """doc: http://open.youku.com/docs/doc?id=31
     """
     url = 'https://openapi.youku.com/v2/users/subscribe/notice.json'
     params = {
         'client_id': self.client_id,
         'access_token': access_token
     }
     r = requests.get(url, params=params)
     check_error(r)
     return r.json()
开发者ID:nsdown,项目名称:youku,代码行数:11,代码来源:youku_users.py


注:本文中的util.check_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。