MCPcopy Create free account
hub / github.com/geekcomputers/Python / fetch_gstins

Function fetch_gstins

gstin_scraper.py:44–58  ·  view source on GitHub ↗
(company_name, csrf_token)

Source from the content-addressed store, hash-verified

42
43
44def fetch_gstins(company_name, csrf_token):
45 third_party_gstin_site = (
46 "https://www.knowyourgst.com/gst-number-search/by-name-pan/"
47 )
48 payload = {"gstnum": company_name, "csrfmiddlewaretoken": csrf_token}
49
50 # Getting the HTML content and extracting the GSTIN content using BeautifulSoup.
51 html_content = requests.post(third_party_gstin_site, data=payload)
52 soup = BeautifulSoup(html_content.text, "html.parser")
53 site_results = soup.find_all(id="searchresult")
54
55 # Extracting GSTIN specific values from child elements.
56 gstins = [result.strong.next_sibling.next_sibling.string for result in site_results]
57
58 return gstins
59
60
61def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected