예제 #1
0
파일: api.py 프로젝트: seasonstar/treeHole
 def test(self):
     try:
         bind_api(
             path = '/help/test.json',
         )(self)
     except WeibopError:
         return False
     return True
예제 #2
0
파일: api.py 프로젝트: seasonstar/treeHole
 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)
예제 #3
0
파일: api.py 프로젝트: seasonstar/treeHole
 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
예제 #4
0
파일: api.py 프로젝트: seasonstar/treeHole
 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)
예제 #5
0
파일: api.py 프로젝트: seasonstar/treeHole
    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)
예제 #6
0
파일: api.py 프로젝트: seasonstar/treeHole
 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
예제 #7
0
파일: api.py 프로젝트: seasonstar/treeHole
 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)
예제 #8
0
파일: api.py 프로젝트: seasonstar/treeHole
 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)
예제 #9
0
파일: api.py 프로젝트: seasonstar/treeHole
 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)
예제 #10
0
파일: api.py 프로젝트: seasonstar/treeHole
 def verify_credentials(self):
     try:
         return bind_api(
             path = '/account/verify_credentials.json',
             payload_type = 'user',
             require_auth = True
         )(self)
     except WeibopError:
         return False
예제 #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