Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#395 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia in Adyen/client.py leggendo _determine_api_url e tracciando le chiamate API esistenti che dipendono da esso. Confronta gli approcci proposti a livello di servizio e basati sul nome del metodo prima di scegliere una mappatura centralizzata. Il lavoro è completato quando i controlli basati su stringhe sono rimossi, la determinazione dell’URL è più facile da estendere e tutte le chiamate API esistenti continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
68
Fork
51
Merge medio
2h 3m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Adyen/adyen-python-api-library

Tutte le issue di Adyen/adyen-python-api-library

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.