GithubHelp home page GithubHelp logo

Comments (17)

thekindlyone avatar thekindlyone commented on August 30, 2024 1

@Bravo111 try this instead of the offending line.. should work.
return json.loads(r._content[9:].decode('utf-8'))['payload']['metadata'][0]

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

@thekindlyone always catch "TypeError: the JSON object must be str, not 'bytes'" exception. Even when use your example (and image url)

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 which example? which python are you using? Show test code please.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

I run this code with python3.5:
imgurl = "http://i.imgur.com/LDQ2ITV.jpg"
client.sendRemoteImage(friend.uid, image=imgurl)
and get an error.
I guess there is a problem in this line return json.loads(r._content[9:])['payload']['metadata'][0]['image_id'].

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 this is the reception of images thread. You are talking about sending images.
But this is not happening in 2.7. Let me check.

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

There are too many pulls right now, and a little bit of a mess due to my inexperience with git. I am pausing sending any more PRs unless the ones already sent are merged. Clone the project and try what I said. Lemme know if it works.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

@thekindlyone, yes, it works great. Don't forget ['image_id'] in the end of this line!
Is it possible to receive images with Echobot now?

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

Yes, image receiving works, but I havent tested it with python3. Please test and tell.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

@thekindlyone, unfortunately it receives empty message with 'has_attachment': False.

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 , receiving , right? Check the metadata.. the urls for the images are in there.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

@thekindlyone, is image_ids[0] what I need? Because there are nothing else in output but timestamps and ids.

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 , no , in the on_message method, that you overrode, you get a metadata argument. The url is in there.
image

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

Think we have different output
2016-08-31 17 55 32

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 are you sending or receiving? this output looks like you have debug=True and are sending. Show test code.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

Receiving. Here's the code:
2016-08-31 17 59 47

from fbchat.

thekindlyone avatar thekindlyone commented on August 30, 2024

@Bravo111 do you see the metadata argument in the on_message method? That is where the url is. Instead of printing message, print metadata. The output you showed me is generated while sending the echo. Turn debug=False if the output is confusing you.

from fbchat.

Bravo111 avatar Bravo111 commented on August 30, 2024

@thekindlyone, yes, now all works perfect. Thanks for tips.

from fbchat.

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.