parameters: (the_record)
docstring: POST finished chain to a callback URL provided
docstring_summary: POST finished chain to a callback URL provided
docstring_tokens: POST finished chain to a callback URL provided
function: def finisher(the_record):
      """
      POST finished chain to a callback URL provided
      """
      db.session.add(the_record)
      verify_ssl = app.config['SSL_HOST_VALIDATION']
      # Set the correct headers for the postback
      headers = {'Content-type': 'application/json', 'Accept': 'text/plain', 'Connection': 'close'}
      #proxy = {"http": "127.0.0.1:8080"}
  
      try:
          # Blacklist IP addresses
          ip_addr = socket.gethostbyname(grab_domain(the_record.url))
  
          if app.config['IP_BLACKLISTING']:
              if netaddr.all_matching_cidrs(ip_addr, app.config['IP_BLACKLISTING_RANGE'].split(',')):
                  the_record.capture_status = "IP BLACKLISTED:{} - ".format(ip_addr) + the_record.capture_status
      except:
          pass
  
      req = post(the_record.callback, verify=verify_ssl, data=json.dumps(the_record.as_dict()), headers=headers)
  
      # If a 4xx or 5xx status is received, raise an exception
      req.raise_for_status()
  
      # Update capture_record and save to database
      the_record.job_status = 'COMPLETED'
      # Removed to propagate blacklist message
      #the_record.capture_status = 'CALLBACK_SUCCEEDED'
      db.session.add(the_record)
      db.session.commit()
function_tokens: def finisher ( the_record ) : db . session . add ( the_record ) verify_ssl = app . config [ 'SSL_HOST_VALIDATION' ] # Set the correct headers for the postback headers = { 'Content-type' : 'application/json' , 'Accept' : 'text/plain' , 'Connection' : 'close' } #proxy = {"http": "127.0.0.1:8080"} try : # Blacklist IP addresses ip_addr = socket . gethostbyname ( grab_domain ( the_record . url ) ) if app . config [ 'IP_BLACKLISTING' ] : if netaddr . all_matching_cidrs ( ip_addr , app . config [ 'IP_BLACKLISTING_RANGE' ] . split ( ',' ) ) : the_record . capture_status = "IP BLACKLISTED:{} - " . format ( ip_addr ) + the_record . capture_status except : pass req = post ( the_record . callback , verify = verify_ssl , data = json . dumps ( the_record . as_dict ( ) ) , headers = headers ) # If a 4xx or 5xx status is received, raise an exception req . raise_for_status ( ) # Update capture_record and save to database the_record . job_status = 'COMPLETED' # Removed to propagate blacklist message #the_record.capture_status = 'CALLBACK_SUCCEEDED' db . session . add ( the_record ) db . session . commit ( )