Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Feature]: Refactor `_determine_api_url` method in `Adyen/client.py`

Abierto
#395 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza en Adyen/client.py leyendo _determine_api_url y rastreando las llamadas API existentes que dependen de él. Compara los enfoques propuestos basados en el nivel de servicio y en el nombre del método antes de elegir un mapeo centralizado. Se considerará terminado cuando se eliminen las comprobaciones basadas en cadenas, sea más fácil ampliar la determinación de la URL y todas las llamadas API existentes sigan funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

do not stale Feature
Feature summary

No response

Problem statement

The _determine_api_url method in Adyen/client.py is fragile and difficult to maintain. It relies on string manipulation and hardcoded values to determine the correct API endpoint URL. This makes it prone to errors and difficult to extend.

Problem:

  • The current implementation uses a series of if/elif statements with in checks on the endpoint string. This is not robust and can break if endpoint names change.
  • It has special logic for "pal-" and "checkout-" prefixes, including hardcoded URLs.
Proposed solution

The logic for determining the correct endpoint URL should be more robust and centralized. Here are two potential approaches:

  1. Service-level mapping: The service calling the client should be responsible for providing the correct and complete URL. The _determine_api_url method would then become a simple pass-through or perform minimal validation.
  2. Method-name-based mapping: Instead of relying on URL substrings, the client could use the service and method names to look up the correct endpoint from a structured configuration or map. This would decouple the logic from the specific URL structure.
Alternatives considered

Another alternative is to rely on the "servers" field of OpenAPI specs, but currently those don't contain mappings for all environments

Additional context

Acceptance Criteria:

  • Remove the string-based checks in _determine_api_url.
  • Implement a more robust mechanism for URL determination.
  • Ensure all existing API calls continue to work correctly.
  • The new implementation should be easier to read, maintain, and extend for future services.
Lenguaje dominante
Python
Estrellas
68
Forks
51
Merge medio
2 h 3 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Adyen/adyen-python-api-library

Todos los issues de Adyen/adyen-python-api-library

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.