fb data extraction error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: fb data extraction error (/thread-15106.html) |
fb data extraction error - periraviteja - Jan-04-2019 Hello Everyone, i'm in learning phase and unable to understand my mistake in retrieving fb data. kindly help me in identifying my mistake. Much thanks in advance Error : syntax error indentation error for this line ( graph = facebook.GraphAPI(access_token)) # Program to mine data from your own facebook account ### Facebook user account data extraction from bs4 import BeautifulSoup import urllib3 import requests import json import facebook def main(): access_token = "{your token}" graph = facebook.GraphAPI(access_token) #fields = ['first_name', 'location{location}','email','link'] profile = graph.get_object(id='me',fields='first_name,location,link,email') #return desired fields print(json.dumps(profile, indent=4)) if __name__ == '__main__': main() ### Facebook page data mining import json import facebook def main(): access_token = "{your token}" graph = facebook.GraphAPI(access_token) page_name = raw_input("Enter a page name: ") # list of fields required fields = ['id','name','about','link','likes','band_members'] fields = ','.join(fields) page = graph.get_object(page_name,fields=fields) print(json.dumps(page,indent(4)) if __name__ == '__main__': main() RE: fb data extraction error - stullis - Jan-05-2019 Nothing appears wrong with the indentation. Did you post the full error traceback? Since there are two main functions, I'm supposing this is in Jupyter Notebooks. Otherwise, the script should give you an error because of a non-unique names. |