-4

Obviously new to scraping but trying to submit the following form: https://apps.fcc.gov/oetcf/eas/reports/GenericSearch.cfm?calledFromFrame=N

Have this script so far, but not sure if I fully understand the payload to go with a post. Are all inputs expected?

import requests
from bs4 import BeautifulSoup
import time

payload ={'grantee_code' : '', 
          'product_code' : '', 
          'product_exact_match' : '', 
          'applicant_name' : '',
          'grant_date_from' : '01/01/2017', 
          'grant_date_to' : '02/01/2017', 
          'comments' : '', 
          'application_purpose' : 'O', 
          'application_purpose_description' : '',
          'sdr_filings_only' : '', 
          'eas_apps_only' : '', 
          'tcb_apps_only' : '', 
          'composite_apps_only' : '',
          'grant_code_1' : '',
          'grant_code_2' : '', 
          'grant_code_3' : '', 
          'test_firm' : '', 
          'application_status' : '', 
          'application_status_description' : '',
          'equipment_class' : '', 
          'equipment_class_description' : '',
          'lower_frequency' : '2402', 
          'upper_frequency' : '2480', 
          'freq_exact_match' : '', 
          'bandwidth_from' : '', 
          'emission_designator' : '', 
          'tolerance_from' : '', 
          'tolerance_to' : '', 
          'tolerance_exact_match' : '', 
          'power_output_from' : '',
          'power_output_to' : '', 
          'power_exact_match' : '', 
          'rule_part_1' : '', 
          'rule_part_2' : '', 
          'rule_part_3' : '', 
          'rule_part_exact_match' : '', 
          'product_description' : '', 
          'modular_type' : '', 
          'modular_type_description' : '', 
          'tcb_code' : '', 
          'tcb_code_description' : '',
          'tcb_scope' : '',
          'tcb_scope_description' : '',
          'outputformat' : 'HTML',
          'show_records' : '499',
          'fetchfrom' : '0',
          'calledFromFrame' : 'N'
          }


url = 'https://apps.fcc.gov/oetcf/eas/reports/GenericSearchResult.cfm?RequestTimeout=500'
r = requests.post(url, payload)
soup = BeautifulSoup(r.text)

print(soup)
lillahimmel
  • 23
  • 1
  • 5

1 Answers1

1

So this was not related to python nor request, but understanding more how HTTP POST work and how that can be debugged. For this, the following question and answer was helpful and guided me to get this to work:

How can I debug a HTTP POST in Chrome?

Community
  • 1
  • 1
lillahimmel
  • 23
  • 1
  • 5