import requests import json import os from selenium import webdriver import datetime def get_goodreads_pages(): payload = { 'email': os.environ.get('EMAIL'), 'password': os.environ.get('PASSW'), } LOGIN_URL= 'https://www.goodreads.com/user/sign_in' driver = webdriver.PhantomJS() driver.get(LOGIN_URL) username = driver.find_element_by_id('user_email') password = driver.find_element_by_id('user_password') username.send_keys(payload['email']) password.send_keys(payload['password']) form = driver.find_element_by_name('sign_in') form.submit() driver.get('https://www.goodreads.com/review/stats/24381583#pages') stats = driver.execute_script('return page_stats') return stats def main(): fake_pages = {'2014': 7375, '2015': 23508, '2016': 17696, '2017': 19706, '2018': 9388} #print(get_goodreads_pages()) if __name__ == "__main__": main()