inputs: "1. Data Acquisition
NOTE: In order to run the data acquisition process, one needs to obtain a token to connect to the Facebook Graph API. This token needs to be saved in a credentials file (by default credentials.ini in the current directory).
We collect data from nine famous Facebook pages actively publishing articles related to the US elections:

Mainstream pages: Politico, CNN and ABC News Politics,
Pro-democrate pages: The Other 98%, Addicting Info and Occupy Democrats,
Pro-republican pages: Eagle Rising, Right Wing News and Freedom Daily.

Each collected post includes the name of the page in addition to:
* the post id post_id,
* the URL of the post post_url, 
* the time created_time when the post was created , 
* the type of post type (i.e. status, link, video, photo), 
* the text message of the post, 
* the number of times the post was shared share_count,
* the number of times the post received a reaction reaction_count,
* the number of times the post was commented comment_count.
1.1 Facebook Web Scraper
To have better flexibility on the scraping process, we collect data using the low-level approach with the requests library. The code of the scraper FacebookScraper, as well as all the code corresponding to the data collection part, is contained in the acquisition module.
The FacebookScraper takes an iterable of Features which represents the fields we want to query on the Facebook Graph API and provide a convenient way to query, clean and save the raw data into a well-formatted pandas.DataFrame. 
Parameters
Define the parameters for the web scraper:
* Credential file where your token is located
* List of the pages to scrape
* Date range over which we want to collect data
* Fields to query"
Please write code following the instructions in jupyter notebook style.

targets: 
# Credential file containing the Facebook authentication token
credentials_file = 'credentials.ini'

# List of pages to scrape
page_list = ['ABCNewsPolitics', 'cnnpolitics', 'politico', 
             'AddictingInfoOrg', 'OccupyDemocrats', 'TheOther98', 
             'FreedomDailyNews', 'OfficialRightWingNews', 'theEagleisRising']

# Define the date range to scrape
start_date = '2016/01/01'
end_date = '2016/12/05'

# Define the fields to query
field_list = [
    Feature('id', name='post_id'),
    Feature('permalink_url', name='post_url'),
    Feature('link'),
    Feature('created_time'),
    Feature('type'),
    Feature('message'),
    Feature('description'),
    Feature('picture'),
    Feature('status_type'),
    Feature('caption'),
    Feature('reactions.limit(0).summary(1)', 
            formatter=lambda data: data.get('reactions', {'summary':{'total_count':0}})['summary']['total_count'], 
            name='reaction_count'),
    Feature('comments.limit(0).summary(1)', 
            formatter=lambda data: data.get('comments', {'summary':{'total_count':0}})['summary']['total_count'], 
            name='comment_count'),
    Feature('shares', 
            formatter=lambda data: data.get('shares', {'count': 0})['count'],
            name='share_count')
]

print('We collect data corresponding to fields:', ', '.join([f.fbquery for f in field_list]))
print('from the Facebook pages: ', ', '.join(page_list))