original_docstring: A method to process record in DynamoDB table using given uuid of the Key.
  
      This method takes an input of dictionary with req_id (uuid) dictionary key.
      DynamoDB table *version3* is queried for this Key. Processes the HTML
      document url stored in the DynamoDB and updates the DynamoDB. This method is
      intended to be called asynchronously hence, no return value.
  
      Parameters
      ----------
      event: list
          A list of dictionaries containing the req_id uuid corresponding to the
          DynamoDB table records.
      context: AWS Lambda Context Object
          A general AWS Lambda Context Object that contains lambda function
          specific information. Unused in this function, however a mandatory
          Lambda function parameter.
      
docstring: A method to process record in DynamoDB table using given uuid of the Key.
  This method takes an input of dictionary with req_id (uuid) dictionary key.
  DynamoDB table *version3* is queried for this Key. Processes the HTML
  document url stored in the DynamoDB and updates the DynamoDB. This method is
  intended to be called asynchronously hence, no return value.
  
  Parameters
  
  list
  A list of dictionaries containing the req_id uuid corresponding to the
  DynamoDB table records.
  context: AWS Lambda Context Object
  A general AWS Lambda Context Object that contains lambda function
  specific information. Unused in this function, however a mandatory
  Lambda function parameter.
docstring_tokens: A method to process record in DynamoDB table using given uuid of the Key . This method takes an input of dictionary with req_id ( uuid ) dictionary key . DynamoDB table * version3 * is queried for this Key . Processes the HTML document url stored in the DynamoDB and updates the DynamoDB . This method is intended to be called asynchronously hence no return value . Parameters list A list of dictionaries containing the req_id uuid corresponding to the DynamoDB table records . context : AWS Lambda Context Object A general AWS Lambda Context Object that contains lambda function specific information . Unused in this function however a mandatory Lambda function parameter .
code: def url_parser(event, context):
      """A method to process record in DynamoDB table using given uuid of the Key.
  
      This method takes an input of dictionary with req_id (uuid) dictionary key.
      DynamoDB table *version3* is queried for this Key. Processes the HTML
      document url stored in the DynamoDB and updates the DynamoDB. This method is
      intended to be called asynchronously hence, no return value.
  
      Parameters
      ----------
      event: list
          A list of dictionaries containing the req_id uuid corresponding to the
          DynamoDB table records.
      context: AWS Lambda Context Object
          A general AWS Lambda Context Object that contains lambda function
          specific information. Unused in this function, however a mandatory
          Lambda function parameter.
      """
      for record in event['Records']:
          processing_id = record.get(
              'dynamodb'
          ).get(
              'Keys'
          ).get(
              'req_id'
          ).get(
              'S'
          )
          record = read_from_db(processing_id)
          if record:
              try:
                  r = requests.get(record['url']['S'])
              except requests.exceptions.RequestException as e:
                  print (e)
                  raise e
              title = extract_title(r.text)
              obj_url = store_to_s3(r.text)
  
              new_record = {
                  'req_id': record['req_id']['S'],
                  'recordstate': 'PROCESSED',
                  's3_url': obj_url,
                  'title': title
              }
              store_to_dynamodb(new_record)
          else:
              resp = dynamodb_client.describe_table(
                  TableName=table_name
              )
              table_arn = resp['Table']['TableArn']
              print ("Bad request. Record with ID %s not found in Database"
                     "table %s" % (processing_id, table_arn))
code_tokens: def url_parser ( event , context ) : for record in event [ 'Records' ] : processing_id = record . get ( 'dynamodb' ) . get ( 'Keys' ) . get ( 'req_id' ) . get ( 'S' ) record = read_from_db ( processing_id ) if record : try : r = requests . get ( record [ 'url' ] [ 'S' ] ) except requests . exceptions . RequestException as e : print ( e ) raise e title = extract_title ( r . text ) obj_url = store_to_s3 ( r . text ) new_record = { 'req_id' : record [ 'req_id' ] [ 'S' ] , 'recordstate' : 'PROCESSED' , 's3_url' : obj_url , 'title' : title } store_to_dynamodb ( new_record ) else : resp = dynamodb_client . describe_table ( TableName = table_name ) table_arn = resp [ 'Table' ] [ 'TableArn' ] print ( "Bad request. Record with ID %s not found in Database" "table %s" % ( processing_id , table_arn ) )
short_docstring: A method to process record in DynamoDB table using given uuid of the Key.
short_docstring_tokens: A method to process record in DynamoDB table using given uuid of the Key .
comment: """A method to process record in DynamoDB table using given uuid of the Key.
  
      This method takes an input of dictionary with req_id (uuid) dictionary key.
      DynamoDB table *version3* is queried for this Key. Processes the HTML
      document url stored in the DynamoDB and updates the DynamoDB. This method is
      intended to be called asynchronously hence, no return value.
  
      Parameters
      ----------
      event: list
          A list of dictionaries containing the req_id uuid corresponding to the
          DynamoDB table records.
      context: AWS Lambda Context Object
          A general AWS Lambda Context Object that contains lambda function
          specific information. Unused in this function, however a mandatory
          Lambda function parameter.
      """