Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending image with fbchat
#1
Hello,

i've started recently working with Python and i want to learn to send automatic messages with fbchat.

I cand send a text message, i can send an Emoji, but the problem is when i try sending a picture from my PC, it doesn't work.
The image is located in "D:/downloads" and the name of the picture is "1623622_833937009956843_569272768_n". Can you please help me ?

import fbchat
from fbchat import Client
from fbchat.models import *
import time
from datetime import datetime
from apscheduler.schedulers.blocking import BlockingScheduler

path = 'D:\Downloads'

def mesaj_fb():

 client = fbchat.Client("username", "password")
 friend = client.searchForUsers("friend's name")
 id = friend[0].uid
 client.sendMessage('Tick! La semnalul urmator va fi ora: %s' % datetime.now(), id)
 client.send(Message(emoji_size=EmojiSize.SMALL), id)
 client.sendLocalImage(id,message='<message text>',image='1623622_833937009956843_569272768_n')

sched = BlockingScheduler()

sched.add_job(mesaj_fb, 'interval', minutes=1)

sched.start()
The log looks like this:

Job "mesaj_fb (trigger: interval[0:01:00], next run at: 2019-12-30 20:57:46 EET)" raised an exception
Traceback (most recent call last):
File "C:\Users......\base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "C:/Users/..../fb chat.py", line 17, in mesaj_fb
client.sendLocalImage(id,message='<message text>',image='1623622_833937009956843_569272768_n')
TypeError: sendLocalImage() got an unexpected keyword argument 'image'

Process finished with exit code -1
Reply


Messages In This Thread
sending image with fbchat - by pylab - Dec-30-2019, 07:01 PM
RE: sending image with fbchat - by snippsat - Dec-30-2019, 08:25 PM
RE: sending image with fbchat - by pylab - Dec-30-2019, 08:39 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020