#!/usr/bin/python import csv import json import argparse import requests from datetime import datetime from dateutil import parser arg_parser = argparse.ArgumentParser(description="Check all the active forms of this site") arg_parser.add_argument("-u", "--url", dest="url", default="https://www.entersite.com", help="URL of main website") arg_parser.add_argument("-d", "--date", dest="changedate", default="1970-01-01", help="Only check for files changed after this date (YYYY-MM-DD)") arg_parser.add_argument("-o", "--output", dest="storagefile", default="output.csv", help="File to store output") arg_parser.add_argument("-c", "--cookie", dest="cookie_credential", default='some_random_cookie_value_here', help="AOS cookie value of logged in user") args = arg_parser.parse_args() # Setting cookie parameter # GETTING ERROR MESSAGE TypeError: 'Namespace' object is not subscriptable on next line. cookie_var = {'AOS': args['cookie_credential']} # Setting change date parameter starting_date = datetime.date(args['changedate'].split("-")) # Tweaking base URL if not str(args['url']).startswith("http"): args['url'] = "https://" + args['url'] base_url = str(args['url']).rstrip("/")