Master data
import requests
import xmltodict
# Replace with your actual API key and request URL
api_key = '579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b'
request_url = 'https://api.data.gov.in/catalog/ec58dab7-d891-4abb-936e-d5d274a6ce9b?api-key=579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b&format=xml'
# Set up the headers with your API key
headers = {
'Authorization': f'Bearer {579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b}',
'Content-Type': 'application/xml'
}
# Make the API request
response = requests.get(request_url, headers=headers)
# Check if the request was successful
if response.status_code == 200:
# Parse the XML response
data = xmltodict.parse(response.text)
# Extract and print the relevant information
for record in data['result']['records']['item']:
print(f"Company Name: {record['company_name']}")
print(f"CIN: {record['corporate_identification_number']}")
print(f"Date of Registration: {record['date_of_registration']}")
print(f"Company Status: {record['company_status']}")
print(f"Registered Office Address: {record['registered_office_address']}")
print('---')
else:
print(f"Failed to retrieve data: {response.status_code}")
Comments
Post a Comment