コード例 #1
0
ファイル: five_hundred_px.py プロジェクト: zachaysan/qtsnap
 def create_new_photo_upload_key(self, authorized_client, **kwargs):
     url = FiveHundredPx.BASE_URL + '/photos'
     url = url + "?" + smart_urlencode(kwargs)
     data = ""
     response = authorized_client.post(url, data=data)
     response_data = _parse_json(response.content)
     return response_data
コード例 #2
0
ファイル: five_hundred_px.py プロジェクト: sg-stalker/PxMagic
 def create_new_photo_upload_key(self, authorized_client, **kwargs):
     url = FiveHundredPx.BASE_URL + '/photos'
     url = url + "?" + smart_urlencode(kwargs)
     data = ""
     response = authorized_client.post(url, data=data)
     response_data = _parse_json(response.content)
     return response_data
コード例 #3
0
ファイル: five_hundred_px.py プロジェクト: zachaysan/qtsnap
 def upload_photo(self, upload_key, photo_id, photo_file, authorized_client):
     """ This method is only useful for client side applications """
     files = {'file': photo_file}
     url = FiveHundredPx.BASE_URL + '/upload'
     access_key = authorized_client.access_token
     kwargs = dict(upload_key=upload_key,
                   photo_id=photo_id,
                   consumer_key=self.consumer_key,
                   access_key=access_key)
     url = url + "?" + smart_urlencode(kwargs)
     response = multipart_post(url, files=files)
     if response.status_code == 200:
         return True
     else:
         print response.content
コード例 #4
0
ファイル: five_hundred_px.py プロジェクト: sg-stalker/PxMagic
 def upload_photo(self, upload_key, photo_id, photo_file,
                  authorized_client):
     """ This method is only useful for client side applications """
     files = {'file': photo_file}
     url = FiveHundredPx.BASE_URL + '/upload'
     access_key = authorized_client.access_token
     kwargs = dict(upload_key=upload_key,
                   photo_id=photo_id,
                   consumer_key=self.consumer_key,
                   access_key=access_key)
     url = url + "?" + smart_urlencode(kwargs)
     response = multipart_post(url, files=files)
     if response.status_code == 200:
         return True
     else:
         print response.content
コード例 #5
0
ファイル: five_hundred_px.py プロジェクト: sg-stalker/PxMagic
    def use_authorized_client(self,
                              authorized_client,
                              url,
                              post_args=None,
                              skip=None,
                              rpp=None,
                              **kwargs):

        resp_data = None
        if skip:
            kwargs['skip'] = skip
        if rpp:
            kwargs['rpp'] = rpp
        if not post_args:
            url += "/?%s" % smart_urlencode(kwargs)
            resp_data = _parse_json(authorized_client.get(url).content)
        else:
            resp_data = _parse_json(
                authorized_client.post(url, data=post_args, **kwargs))
        return resp_data
コード例 #6
0
ファイル: five_hundred_px.py プロジェクト: 500px/PxMagic
 def use_authorized_client(self,
                           authorized_client,
                           url,
                           post_args=None,
                           skip=None,
                           rpp=None,
                           **kwargs):
     
     resp_data = None
     if skip:
         kwargs['skip'] = skip
     if rpp:
         kwargs['rpp'] = rpp
     if not post_args:
         url += "/?%s" % smart_urlencode(kwargs)
         resp_data = _parse_json(authorized_client.get(url).content)
     else:
         resp_data = _parse_json(authorized_client.post(url,
                                                        data=post_args,
                                                        **kwargs))
     return resp_data