19 lines
581 B
Python
19 lines
581 B
Python
import requests
|
|
|
|
ETENDERS_API_URL = "https://www.etenders.gov.za/api/v1/tenders"
|
|
|
|
def get_tenders():
|
|
"""
|
|
Fetches a list of tenders from the eTenders API.
|
|
|
|
Returns:
|
|
list: A list of tenders as dictionaries, or None if an error occurs.
|
|
"""
|
|
try:
|
|
response = requests.get(ETENDERS_API_URL)
|
|
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
|
|
return response.json()
|
|
except requests.exceptions.RequestException as e:
|
|
print(f"Error fetching tenders from eTenders API: {e}")
|
|
return None
|