Giter VIP home page Giter VIP logo

Comments (4)

martey avatar martey commented on May 21, 2024

In the documentation the first parameter is the filename, while in the method it seems a file-like object.

Which documentation is this? The method's docstring clearly states that it should be a Python file-like object. The official Graph API documentation states that the API endpoint (me/photos) needs multipart/form-data but the method takes care of converting this. Where is the reference to using filenames?

Passing a file like object as a first paramter (called image) I recevice an unicode conversion error.

Could you provide a traceback? The following code worked for me:

>>> import facebook
>>> graph = facebook.GraphAPI("[redacted access token]")
>>> graph.put_photo(open("test.jpg"), "this is a test upload...please feel free to ignore")
{u'post_id': u'1867_10100367232455011', u'id': u'10100367232430061'}

from facebook-sdk.

lucapinello avatar lucapinello commented on May 21, 2024

Hi Martey!
Thanks a lot for the quick answer.

Sorry I was confused from the Readme.md where I saw:

Photo uploads:

graph = facebook.GraphAPI(oauth_access_token)
tags = json.dumps([{'x':50, 'y':50, tag_uid:12345}, {'x':10, 'y':60,
tag_text:'a turtle'}])
graph.put_photo('img.jpg', 'Look at this cool photo!',
album_id_or_None, tags=tags)

You should update it to avoid confusion.

I will try with a file like object and I'll let you know.

Thanks again.

Luca

2012/5/7 Martey Dodoo
[email protected]:

In the documentation the first parameter is the filename, while in the method it seems a file-like object.

Which documentation is this? The method's docstring clearly states that it should be a Python file-like object. The official Graph API documentation states that the API endpoint (me/photos) needs multipart/form-data but the method takes care of converting this. Where is the reference to using filenames?

Passing a file like object as a first paramter (called image) I recevice an unicode conversion error.

Could you provide a traceback? The following code worked for me:

>>> import facebook
>>> graph = facebook.GraphAPI("[redacted access token]")
>>> graph.put_photo(open("test.jpg"), "this is a test upload...please feel free to ignore")
{u'post_id': u'1867_10100367232455011', u'id': u'10100367232430061'}

Reply to this email directly or view it on GitHub:
#30 (comment)

from facebook-sdk.

lucapinello avatar lucapinello commented on May 21, 2024

It worked perfectly, thanks again for your patience and for you great
job with this library.

Best,

Luca

2012/5/7 Luca Pinello [email protected]:

Hi Martey!
Thanks a lot for the quick answer.

Sorry I was confused from the Readme.md where I saw:

Photo uploads:

graph = facebook.GraphAPI(oauth_access_token)
tags = json.dumps([{'x':50, 'y':50, tag_uid:12345}, {'x':10, 'y':60,
tag_text:'a turtle'}])
graph.put_photo('img.jpg', 'Look at this cool photo!',
album_id_or_None, tags=tags)

You should update it to avoid confusion.

I will try with a file like object and I'll let you know.

Thanks again.

Luca

2012/5/7 Martey Dodoo
[email protected]:

In the documentation the first parameter is the filename, while in the method it seems a file-like object.

Which documentation is this? The method's docstring clearly states that it should be a Python file-like object. The official Graph API documentation states that the API endpoint (me/photos) needs multipart/form-data but the method takes care of converting this. Where is the reference to using filenames?

Passing a file like object as a first paramter (called image) I recevice an unicode conversion error.

Could you provide a traceback? The following code worked for me:

>>> import facebook
>>> graph = facebook.GraphAPI("[redacted access token]")
>>> graph.put_photo(open("test.jpg"), "this is a test upload...please feel free to ignore")
{u'post_id': u'1867_10100367232455011', u'id': u'10100367232430061'}

Reply to this email directly or view it on GitHub:
#30 (comment)

from facebook-sdk.

martey avatar martey commented on May 21, 2024

Thanks, Luca. The README has been updated in commit c92fa6a.

from facebook-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.