Error al realizar la solicitud: Expecting value


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)

    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)
        print("No issues found.")

except requests.exceptions.RequestException as e:
    print("Error al realizar la solicitud:", e)
return data

sonarqube_url = ‘
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?


Welcome to the community!

Unfortunately, I don’t understand what’s not happening for you. Can you provide more detail - in English?


Hi Ann,
thank you so much,
What I’m trying to do in python is get the bugs, issues and code smells of a project in json.


Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.