Example #1
0
def updateFacebookStatus(status):

    #   fb.APP_ID = FACEBOOK_ID
    fb.AUTH_SCOPE = ["publish_stream"]
    fb.authenticate()
    fb.post("/crimson.beacon/feed", {"message": status})
    fb.logout()
Example #2
0
def updateFacebookStatus(status):

    #   fb.APP_ID = FACEBOOK_ID
    fb.AUTH_SCOPE = ['publish_stream']
    fb.authenticate()
    fb.post('/crimson.beacon/feed', {'message': status})
    fb.logout()
Example #3
0
def fbpost(request):
	fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
	fbconsole.authenticate()
	month = datetime.datetime.now().strftime("%B")
	day = datetime.datetime.now().strftime("%d")
	query = day+" "+month
	person = Person.objects.filter(date_of_birth=query,photo__isnull=False)[:60]
	for p in person:
		url = "http://muvidb.com/cast_%d.dhtml"%p.id 
		fbconsole.post('/me/feed', {'link':url})
		time.sleep(30)
		
	return HttpResponseRedirect(reverse('home'))
Example #4
0
	def broadcast_now(self, value):
		update = root.children[3].text
		if fb_on:
			try:
				fbconsole.post('/me/feed', {'message':update})
			except:
				print "Error while posting to FB"
		
		if twit_on:
			try:
				twitter.statuses.update(status=update)
			except:
				print "Error while psoting to Twitter"
Example #5
0
	def _print_grades(self, results, ogpa, new = []):
			if new:
				# what to do when new grades are released
				message = "Exam grades for %s are currently being rolled out. Good luck!" % ' and '.join(new)
				fbconsole.post('/your-facebook-group/feed', {'message': message})

			print "\n+%s+" % ("UoA %s Exam Grades" % self.semesters[self.semester-1]).center(42, '-')
			print "+------------------------------------------+"
			print "|      Course      |  Grade  |  GPA Score  |"
			print "+------------------------------------------+"
			for course, (grade, gpa) in results.iteritems():
				print "| %s | %s | %s |" % (course.center(16), grade.center(7), gpa.center(11))
			print "+------------------------------------------+"
			print "| Overall GPA as of chosen semester: %s | " % (ogpa if ogpa else '-.---')
			print "+------------------------------------------+\n"
Example #6
0
File: demo.py Project: nitzzz/new
    def post(self):
        result = flask.request.form['expression']
	status = fbconsole.post('/me/feed', {'message':result})
	likes = fbconsole.get('/'+status['id']+'/likes')
        flask.flash(result)
        fbconsole.logout()
        return self.get()
Example #7
0
    def updateStatus(self, speech, language):
        if (language == "de-DE"):
            if (speech.find('Update status') == 0):
                speech = speech.replace('Update status', ' ',1)
            elif (speech.find('Facebook status') == 0):
                speech = speech.replace('Facebook status',' ',1)
            elif (speech.find('Post status') == 0):
                speech = speech.replace('Post status',' ',1)            
            speech = speech.strip()
            if speech == "":
                speech = self.ask("Was willst du posten?")
        self.say("Dein Status lautet:")
        self.say(speech);
        ansewer =  self.ask("Fertig zu senden?")
        if (ansewer == "Ja"):
	  fbconsole.post('/me/feed', {'message': speech})
	  self.say ("Dein Status wurde gesendet !")
	  self.complete_request()
	else :
	  self.say("Ok, ich werde es nicht senden.")
	  self.complete_request()
Example #8
0
    def updateStatus(self, speech, language):
        if (language == "en-US"):
            if (speech.find('Update status') == 0):
                speech = speech.replace('Update status', ' ',1)
            elif (speech.find('Facebook status') == 0):
                speech = speech.replace('Facebook status',' ',1)
            elif (speech.find('Post status') == 0):
                speech = speech.replace('Post status',' ',1)            
            speech = speech.strip()
            if speech == "":
                speech = self.ask("What is your status?")
        self.say("Your status is :")
        self.say(speech);
        ansewer =  self.ask("Are you sure want post it ?")
        if (ansewer == "Yes"):
	  fbconsole.post('/me/feed', {'message': speech})
	  self.say ("Your status was posted !")
	  self.complete_request()
	else :
	  self.say("OK, I wont post it.")
	  self.complete_request()
Example #9
0
def post_status(message):
    """Delete the old status then post a new one."""

    global LAST_POST_ID
    global GROUP_ID

    # check if logged in
    try:
        fbconsole.get("/me")
    except:
        authenticate()

    # delete the old status
    if LAST_POST_ID is not None:
        fbconsole.delete("/"+LAST_POST_ID)

    #make new status
    post = fbconsole.post("/" + GROUP_ID + "/feed",{"message":message})
    LAST_POST_ID = post['id']
Example #10
0
def post_status(message):
    """Delete the old status then post a new one."""

    global LAST_POST_ID
    global GROUP_ID

    # check if logged in
    try:
        fbconsole.get("/me")
    except:
        authenticate()

    # delete the old status
    if LAST_POST_ID is not None:
        fbconsole.delete("/" + LAST_POST_ID)

    #make new status
    post = fbconsole.post("/" + GROUP_ID + "/feed", {"message": message})
    LAST_POST_ID = post['id']
Example #11
0
  else:
    rMax = int(sys.argv[2])

if len(sys.argv) >= 4:
  if len(sys.argv[3]) == 0:
    subFolder="home"
  elif sys.argv[3] == 'h':
    subFolder="home"
  elif sys.argv[3] == 'm':
    subFolder="feed"
  else:
    subFolder="home"
#==== input control ====

if sys.argv[1] == 'p':
  status = fbconsole.post("/me/feed", {"message":sys.argv[2]})
elif sys.argv[1] == 'r':



  for post in fbconsole.iter_pages(fbconsole.get('/me/'+subFolder)):
    #==== MESSAGE ====
    print ''
    dedented_text = textwrap.dedent(post.get('message',defMsgs)).strip()
    print colorstr(textwrap.fill(dedented_text,width=40, initial_indent=' '+post.get('from',defMsgs).get('name',defMsgs)+":", subsequent_indent='    '),'YELLOW')
    #print post.get('comments',defComments)
    #print len(post.get('comments',defComments))
    #print post.get('comments',defComments)
    if post.get('comments',defComments).get('count',defMsgs) != 0:
      #==== PICTURE ====
      if post.get('picture',defPic)!='no pic':    
Example #12
0
def update_status(update):
	status = fbconsole.post('/me/feed', {'message':update})
Example #13
0
import fbconsole

fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
fbconsole.authenticate()

import os

for dirname, dirnames, filenames in os.walk('./pics/'):
    # print path to all filenames.
    for filename in filenames:
        picname = os.path.join(dirname, filename)
        print picname
        response = fbconsole.post('/me/photos', {'source': open(picname)})
        print response
        picid = response['id']
        tag = fbconsole.post('/' + picid + '/tags', {
            'to': 'USER-ID-HERE',
            'x': '0',
            'y': '0'
        })
Example #14
0
 def post(self, data):
     result = fbconsole.post('/me/feed', {'message':data})
Example #15
0
#!/usr/bin/env python
# coding=utf-8
import fbconsole
import sys

#fbconsole.APP_ID = '702463706522649'
#fbconsole.automatically_authenticate('LOGIN','PASS','9cbf04214ed96eb7bf859edb2990acf4','request_uri')
#status = fbconsole.post('/me/feed', {'message':'Hello from my awesome script'})

fbconsole.APP_ID = '702463706522649'
fbconsole.AUTH_SCOPE = [ 'manage_pages','publish_actions']
fbconsole.authenticate()
msg = sys.argv
status = fbconsole.post("/me/feed", {"message":msg[1]})
Example #16
0
#!/usr/bin/python
import sys
import fbconsole
fbconsole.APP_ID = '177876045644347'
fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins', 'read_stream', 'offline_access']
fbconsole.authenticate()
uri = sys.argv[1]
picture = fbconsole.post('/me/photos', {'source':open(uri)})
print "Picture posted, ID %s" % picture['id']

Example #17
0
 def post(self, data):
     result = fbconsole.post('/me/feed', {'message': data})
Example #18
0
#!/usr/bin/python
import sys
import fbconsole
fbconsole.APP_ID = '177876045644347'
fbconsole.AUTH_SCOPE = [
    'publish_stream', 'publish_checkins', 'read_stream', 'offline_access'
]
fbconsole.authenticate()
uri = sys.argv[1]
picture = fbconsole.post('/me/photos', {'source': open(uri)})
print "Picture posted, ID %s" % picture['id']
#A url cannot have spaces as parameters, so we replace all the spaces with '+'
text_to_convert = text_to_convert.replace(' ', '+')

#Passing the parameters. This url you get via LiveHTTPHeader Firefox Plugin. Experiment with it, its easy.
url = 'http://translate.google.com/?sl=%s&tl=%s&text=%s' % (convert_from, convert_to, text_to_convert)

#Get the content
data = requests.get(url).content

#If you do this, it does not convert the elements properly.
#soup = BeautifulSoup(data)

#For unicode support use this.
soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
#soup = BeautifulSoup(data)

#Getting the result which is in div gt-res-content and inside that its in span result_box's text. Use Firebug to check this.
div_content = soup.find('div', {'id' : 'gt-res-content'})
converted_text = div_content.find('span', {'id':'result_box'}).text

#Awesomeness of Scraping!! woot woot :D /\
print "Converted Text : " + converted_text


#All the bloody Permissions I can get :p lol, and even the cookie doesn't expire soon ;)
fbconsole.AUTH_SCOPE = [ 'user_about_me',  'friends_about_me',  'user_activities',  'friends_activities',  'user_birthday',  'friends_birthday',  'user_checkins',  'friends_checkins',  'user_education_history',  'friends_education_history',  'user_events',  'friends_events',  'user_groups',  'friends_groups',  'user_hometown',  'friends_hometown',  'user_interests',  'friends_interests',  'user_likes',  'friends_likes',  'user_location',  'friends_location',  'user_notes',  'friends_notes',  'user_online_presence',  'friends_online_presence',  'user_photo_video_tags',  'friends_photo_video_tags',  'user_photos',  'friends_photos',  'user_questions',  'friends_questions',  'user_relationships',  'friends_relationships',  'user_relationship_details',  'friends_relationship_details',  'user_religion_politics',  'friends_religion_politics',  'user_status',  'friends_status',  'user_videos',  'friends_videos',  'user_website',  'friends_website',  'user_work_history',  'friends_work_history',  'email', 'read_friendlists',  'read_insights',  'read_mailbox',  'read_requests',  'read_stream',  'xmpp_login',  'ads_management',  'create_event',  'manage_friendlists',  'manage_notifications',  'offline_access',  'publish_checkins',  'publish_stream',  'rsvp_event',  'sms',  'publish_actions']
fbconsole.authenticate()

status = fbconsole.post('/me/feed', {'message':converted_text})
Example #20
0
import urllib,json
from pyshutils import *
import fbconsole

cd("/usr/lib/picplz-fb")

fbconsole.AUTH_SCOPE = ['publish_stream',"offline_access"]
fbconsole.authenticate()
uploaded = load("picplz-uploaded",set())

data = json.loads(urllib.urlopen("http://api.picplz.com/api/v2/user.json?id=623640&include_pics=1&pic_page_size=10").read())
assert data["result"] == "ok"
photos = data["value"]["users"][0]["pics"]
photos.sort(key=lambda x:x["date"])

for img in photos:
    if img["id"] not in uploaded:
        caption = img["caption"].encode("utf-8")
        if "place" in img:
            caption = "%s (@ %s)" % (caption,img["place"]["name"].encode("utf-8"))

        print "uploading ", caption
        uploaded.add(img["id"])
        fi,headers = urllib.urlretrieve(img["pic_files"]["640r"]["img_url"])
        fbconsole.post('/2246799144449/photos', {
            'source':open(fi,"rb"),
            'message': "%s\n\nTaken with PicPlz http://picplz.com%s" % (caption,img["url"].encode("utf-8"))
        })

save("picplz-uploaded",uploaded)
Example #21
0
                 imsg += "0"
             else:
                 imsg += "1"
     imsg += "\n"
     print "writing image"
     print imsg
     ser.write(imsg)
     waitforack(ser, "g")
     displaying = "post"
 if line.startswith(".l"):
     if displaying == "post":
         likeurl = "/"+postid+"/likes"
         print "POST "+likeurl
         post = newsfeedData[itemnum]
         if postid not in liked:
             fbconsole.post("/"+postid+"/likes", {})
             #Just assume that it worked and change the data ;-)
             if "likes" not in post:
                 
                 PyDict_SetItem(post, "likes", {"count":1})
             else:
                 numlikes = post["likes"]["count"]
                 post["likes"]["count"] = numlikes+1
             liked.append(postid)
         else:
             fbconsole.post("/"+postid+"/likes&method=DELETE", {})
             numlikes = post["likes"]["count"]
             if numlikes == 1:
                 post["likes"].remove("count")
             else:
                 post["likes"]["count"] = numlikes-1
Example #22
0
#!/usr/bin/env python

import urllib2
import sys
import fbconsole

# uncomment if proxy support required
#fbconsole.PROXY_SUPPORT = urllib2.ProxyHandler({"http" : "http://10.3.11.251:9090"}) 

fbconsole.AUTH_SCOPE = ['user_photos','publish_stream']
fbconsole.authenticate()

albums = fbconsole.get('/me/albums')
alb_id = None
for i in range(len(albums['data'])):
    if albums['data'][i]['name'] == 'Hackathon':
        alb_id = albums['data'][i]['id']
        break

if alb_id == None:
    alb = {'message': 'Hackathon Test','name': 'Hackathon'}
    aid = fbconsole.post('/me/albums',alb)
    alb_id = aid['id']

for i in range(1,len(sys.argv)):
    fbconsole.post('/'+alb_id+'/photos/', {'source':open(sys.argv[i])})


#!/usr/bin/python
import sys
import fbconsole
fbconsole.APP_ID = '177876045644347'
fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins', 'read_stream', 'offline_access']
fbconsole.authenticate()
message = sys.argv[1]
status = fbconsole.post('/me/feed', {'message': message})
print "Status posted, ID %s" % status['id']
Example #24
0
 def reply_messages(self, msg):
     for message in self.get_posts_with_words([u"felicidades", u"parabéns"]):
         fb.post("/" + message.id + "/comments", {"message" : msg})
         time.sleep(1)
Example #25
0
import fbconsole
fbconsole.AUTH_SCOPE = ['publish_actions']
fbconsole.authenticate()
fbconsole.post('/me/feed', {'message':'Python Rocks!!!'})
fbconsole.logout()
Example #26
0
 def reply_messages(self, msg):
     for message in self.get_posts_with_words([u"felicidades",
                                               u"parabéns"]):
         fb.post("/" + message.id + "/comments", {"message": msg})
         time.sleep(1)
Example #27
0
import fbconsole

fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
fbconsole.authenticate()

import os

for dirname, dirnames, filenames in os.walk('./pics/'):
   # print path to all filenames.
    for filename in filenames:
        picname = os.path.join(dirname, filename)
        print picname
        response = fbconsole.post('/me/photos', {'source':open(picname)})
        print response
        picid = response['id']
        tag = fbconsole.post('/'+picid+'/tags', {'to':'USER-ID-HERE', 'x':'0', 'y':'0'})
def print1():
    horoscope1(moon_sign)
    horoscope2(moon_sign)
    horoscope3(moon_sign)


while True:
    try:
        moon_sign = raw_input("Your moon sign : ").lower()

        print1()

        #Posting on fb
        import fbconsole as fb
        fb.AUTH_SCOPE = ['public_profile', 'user_friends', 'manage_pages']
        fb.APP_ID = '738141636393999'
        fb.authenticate()
        fb.post('/me/feed/',
                {'message': 'Today\'s Horoscope : ' + moon_sign + '\n\n' + a})
        fb.post('/me/feed/',
                {'message': 'Today\'s Horoscope : ' + moon_sign + '\n\n' + c})
        fb.post('/me/feed/',
                {'message': 'Today\'s Horoscope : ' + moon_sign + '\n\n' + d})
        fb.logout()
        break

    except urllib2.HTTPError:

        print "Entered sign is incorrect.Please enter coorect one"
        time.sleep(1)
Example #29
0
def post_msg(fb, path, msg):
    fb.post(path, {"message": msg})
#!/usr/bin/python
import sys
import fbconsole
fbconsole.APP_ID = '177876045644347'
fbconsole.AUTH_SCOPE = [
    'publish_stream', 'publish_checkins', 'read_stream', 'offline_access'
]
fbconsole.authenticate()
message = sys.argv[1]
status = fbconsole.post('/me/feed', {'message': message})
print "Status posted, ID %s" % status['id']
# 
# import fbconsole as Facebook
# Facebook.APP_ID=APP_ID
# #Facebook.ACCESS_TOKEN=SECRET_KEY
# Facebook.AUTH_SCOPE=['publish_stream']
# Facebook.authenticate()
# Facebook.post('/me/feed',{'message':statusmsg})
# Facebook.logout()

import fbconsole as Facebook
APP_ID='256039541189094'
SECRET_KEY='cf28017ad90f5ed612c8282f9c9e07c1'
GRANT_TYPE='client_credentials'
AUTH_SCOPE='publish_stream'
REDIRECT_URL='http://127.0.0.1:8080'
access_token_url='https://graph.facebook.com/oauth/access_token?client_id=%s&client_secret=%s&grant_type=%s&scope=%s'%(APP_ID,SECRET_KEY,GRANT_TYPE,AUTH_SCOPE)       


print access_token_url
import urllib
res=urllib.urlopen(access_token_url)
ACCESS_TOKEN=res.read()
print ACCESS_TOKEN
ACCESS_TOKEN=ACCESS_TOKEN.split('=')[1]


Facebook.ACCESS_TOKEN=ACCESS_TOKEN
Facebook.AUTH_SCOPE=[AUTH_SCOPE]

Facebook.post('/me/feed',{'message':statusmsg})
Facebook.logout()
#fbconsole:github.com/fbsamples/fbconsole

import fbconsole


def FB_Login():
    fbconsole.AUTH_SUCCESS_HTML = '<h3>Close Window</h3>'

    fbconsole.AUTH_SCOPE = [
        'read_friendlists', 'read_stream', 'publish_checkins',
        'publish_actions', 'manage_pages'
    ]

    fbconsole.authenticate()


def FB_Logout():
    fbconsole.logout()


if __name__ == "__main__":
    fb_who = 'me'

    FB_Login()
    fbconsole.post('/me/feed', {'message': u"小助手上台一鞠躬"})
    #\u5c0f\u52a9\u624b\u4e0a\u53f0\u4e00\u97a0\u8eac

    FB_Logout()

    print "END"