The name is tweetup but unfortunately I do not like/use twitter so it works on facebook. The script can update text status also with the previous one(uploading a pic with description).
1 #!/usr/bin/env python 2 import fbconsole 3 import argparse 4 import os 5 import sys 6 7 flag_path = 0 8 flag_desc = 0 9 10 def update_it(status_update): 11 ''' 12 function to update text status 13 ''' 14 15 fbconsole.post('/me/feed', {'message': status_update}) 16 17 def post_it(path, desc): 18 ''' 19 function to post a image with or without description 20 ''' 21 22 if desc == 1: 23 fbconsole.post('/me/photos', {'source':open(args.file), 'message':args.description}) 24 else: 25 fbconsole.post('/me/photos', {'source':open(args.file)}) 26 27 parser = argparse.ArgumentParser(description = 'Update your facebook status') 28 parser.add_argument("-f", "--file", type = str, 29 help = "Path to file to upload") 30 parser.add_argument("-d", "--description", type = str, 31 help = "Give the description of the file") 32 parser.add_argument("-p", "--post", type = str, 33 help = "Give the status update to post") 34 args = parser.parse_args() 35 36 37 fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins'] 38 fbconsole.authenticate() 39 40 if args.file: 41 if os.path.exists(args.file): 42 flag_path = 1 43 if args.description: 44 flag_desc = 1 45 else: 46 print "File does not exist" 47 sys.exit(-1) 48 post_it(flag_path, flag_desc) 49 50 if args.post: 51 update_it(args.post) 52 53 fbconsole.logout() 54 sys.exit(0)
$ sudo pip install -i https://testpypi.python.org/pypi tweetup
will do the job.
You can check the code here
The command is:
$ tweetup -f <path_to_image> -d <descrption>
The above will upload a picture with the given description. You can upload a picture without a description too. For this do:
$ tweetup -f <path_to_image>
When you give the command for the very first time in your computer it will open your default browser window. It will ask you to login. Authorize the application and then set up the settings for this application and all done.
(virt3)sudip@sudip-mint $ tweetup -h usage: tweetup.py [-h] [-f FILE] [-d DESCRIPTION] [-p POST] Update your facebook status optional arguments: -h, --help show this help message and exit -f FILE, --file FILE Path to file to upload -d DESCRIPTION, --description DESCRIPTION Give the description of the file -p POST, --post POST Give the status update to post (virt3)sudip@sudip-mint $ tweetup -f /home/sudip/fb.jpg -d "It was awesome" (virt3)sudip@sudip-mint $ tweetup -p "Updated status via fbconsole"