Hi,
I’m having a problem, I’ve been trying to solve it in different ways but it’s always giving me the same message.
import requests
Realiza una solicitud a la API de SonarQube para obtener datos de calidad del código
def obtener_datos_sonarqube(proyecto):
headers = {‘Authorization’: f’Bearer {sonarqube_token}‘}
response = requests.get(f’{api_endpoint}', params={‘component’: proyecto, ‘metricKeys’: ‘code_smells,bugs,vulnerabilities’,‘types’: ‘BUG,VULNERABILITY’}, headers=headers)
try:
data = response.json()
# # Check if there are issues
if data["total"] > 0:
# Iterate over issues
for issue in data["issues"]:
# Extract relevant information
issue_key = issue["key"]
issue_type = issue["type"]
issue_severity = issue["severity"]
issue_message = issue["message"]
# Display issue details
print(f"Issue Key: {issue_key}")
print(f"Type: {issue_type}")
print(f"Severity: {issue_severity}")
print(f"Message: {issue_message}")
print("-" * 50)
else:
print("No issues found.")
except requests.exceptions.RequestException as e:
print("Error al realizar la solicitud:", e)
return data
sonarqube_url = ‘https://e8.dddata.com/sonar’
sonarqube_token = ‘sqp_4yyyyyyyyyyyyyyyd14915f’
SonarQube API endpoint to retrieve issues
api_endpoint = f"{sonarqube_url}/api/issues/search"
proyecto = “GCFFWEB”
sonarqube_data = obtener_datos_sonarqube(proyecto)
Error al realizar la solicitud: Expecting value: line 1 column 1 (char 0)
Could you help me, please?
thanks