Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Python
# -*- coding: utf-8 -*- 
import fbconsole as F 
from codecs import open, BOM_UTF8 
import os.path 
import time 
import random 

def Main(): 
if(os.path.exists("Messages.txt")): 
print "File Found, Would You Like To Make A New One?" 
x=raw_input("Y/N: ") 
if (x=="Y"): 
t=int(raw_input("How Many Messages Would You Like To Enter?: ")) 
x=GetMsgs(t) 
SaveMsg(x) 
else: 
t = sum(1 for line in open('Messages.txt')) 
else: 
t=int(raw_input("How Many Messages Would You Like To Enter?: ")) 
x=GetMsgs(t) 
SaveMsg(x) 
StartUp(t) 

def StartUp(t): 
F.AUTH_SCOPE = ['publish_stream'] 
F.authenticate() 
LoadMsg(t) 
LogOut() 

def GetMsgs(x): 
dic=[] 
c=0 
while (c!=x): 
msg=raw_input("Enter The Message: ") 
c=c+1 
dic.append(msg) 
return dic 

def SaveMsg(dic): 
OP=open("Messages.txt","w",encoding="utf... 
for i in dic: 
OP.write(i) 
OP.write("\n") 
OP.close() 

def LoadMsg(t): 
output=open("Messages.txt","r",encoding=... 
lines=output.readlines() 
output.close() 
while True: 
z=RandNum(t) 
line=lines[z] 
line=line.rstrip("\n") 
Post(line) 

def RandNum(x): 
return random.randint(0,x-1) 

def Post(st): 
status=F.post('/me/feed', {'message':st}) 
time.sleep(14400) 

def LogOut(): 
F.logout() 
print "The Program Has Finished!" 

Main() 


So I have this code that gets messages and every 4 hours it posts a random message
I tried to post on facebook using this code few hours ago and all worked fine.
I did some tweaks and tried to run it again and I'm getting this error Application request limit reached
I tried to post a simple thing on facebook and still the same problem
with this code

Python
import fbconsole as F 

F.AUTH_SCOPE = ['publish_stream'] 
F.authenticate() 
status=F.post('/me/feed', {'message':"HI!"}) 
F.logout() 


>and still the same problem
What can I do to fix it?
Thanks!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900