Exemple #1
0
 def test(self):
     try:
         bind_api(
             path = '/help/test.json',
         )(self)
     except WeibopError:
         return False
     return True
Exemple #2
0
 def update_profile_background_image(self, filename, *args, **kargs):
     headers, post_data = API._pack_image(filename, 800)
     bind_api(
         path = '/account/update_profile_background_image.json',
         method = 'POST',
         payload_type = 'user',
         allowed_param = ['tile'],
         require_auth = True
     )(self, post_data=post_data, headers=headers)
Exemple #3
0
 def exists_block(self, *args, **kargs):
     try:
         bind_api(
             path = '/blocks/exists.json',
             allowed_param = ['id', 'user_id', 'screen_name'],
             require_auth = True
         )(self, *args, **kargs)
     except WeibopError:
         return False
     return True
Exemple #4
0
 def destroy_list(self, slug):
     return bind_api(
         path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
         method = 'DELETE',
         payload_type = 'list',
         require_auth = True
     )(self)
Exemple #5
0
    def upload(self, filename, status, lat=None, long=None, source=None):
        if source is None:
            source=self.source
        headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname="pic")
        args = [status]
        allowed_param = ['status']
        
        if lat is not None:
            args.append(lat)
            allowed_param.append('lat')
        
        if long is not None:
            args.append(long)
            allowed_param.append('long')
        
        if source is not None:
            args.append(source)
            allowed_param.append('source')
        kargs={
               'post_data': post_data,
               'headers': headers,
               }    
        return bind_api(
            path = '/statuses/upload.json',            
            method = 'POST',
            payload_type = 'status',
            require_auth = True,
            allowed_param = allowed_param            
#        )(self, *args, post_data=post_data, headers=headers)
         )(self, *args, **kargs)
Exemple #6
0
 def is_subscribed_list(self, owner, slug, user_id):
     try:
         return bind_api(
             path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),
             payload_type = 'user'
         )(self)
     except WeibopError:
         return False
Exemple #7
0
 def remove_list_member(self, slug, *args, **kargs):
     return bind_api(
         path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
         method = 'DELETE',
         payload_type = 'list',
         allowed_param = ['id'],
         require_auth = True
     )(self, *args, **kargs)
Exemple #8
0
 def update_list(self, slug, *args, **kargs):
     return bind_api(
         path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
         method = 'POST',
         payload_type = 'list',
         allowed_param = ['name', 'mode', 'description'],
         require_auth = True
     )(self, *args, **kargs)
Exemple #9
0
 def update_profile_image(self, filename):
     headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)
     return bind_api(
         path = '/account/update_profile_image.json',
         method = 'POST',
         payload_type = 'user',
         require_auth = True
     )(self, post_data=post_data, headers=headers)
Exemple #10
0
 def verify_credentials(self):
     try:
         return bind_api(
             path = '/account/verify_credentials.json',
             payload_type = 'user',
             require_auth = True
         )(self)
     except WeibopError:
         return False
Exemple #11
0
def get_comment(request, weiboid):
    api = get_auth(request, 1)
    path = '/statuses/show/' + str(weiboid) + '.json'
    get_status = bind_api( path = path, payload_type = 'status' )
    weibo = get_status(api)
    commentlist = []
    try:
        timeline = api.comments(id=weiboid)
    except WeibopError, e:
        return e.reason