November 27th, 2012, 07:29 PM
About Python for facebook API [parsing messagefile]
I'm newbie in Python and I'm now learning about Facebook API in Python. I'm trying to parse the message data from facebook which I can do query from
Frist, I parse the data from url and I load url into json format, then I retreive data as ['data']
but the problem is when I fetch data from query ['message'], it works but it got crashed because the next line has not "message" in that query. My question is I want to fetch lots of data but I don't want my application to get stopped when it found that the next line has no "message" on that query, what should I do?
Here's my code:
Assume that when the data goes to i=9, and that line has no query name 'message', my application will stop at that line and not continue to run until it finished. If you know something about my problem, please help me.
response = urllib.urlopen(url).read()
data = json.loads(response)
results = data['data']
for i in range(50):
I'm looking forward to see your answer,
Thank you so much
December 4th, 2012, 10:44 PM
Oh gosh, nobody can answer my question at all, I've tried so many ways but it still can not pass when that line has no ['message']
I'm stuck can somebody at least suggest about how to skip the line or how to continue running by ignore an error value please..
December 5th, 2012, 10:52 AM
Run the process in a separate thread and kill it when a timer expires.
[/code] are essential for python code and Makefiles!