AnswerDotAI / AnswerDotAI/ghapi
Issues in the api wrappers while downloading logs
- Lingua principale
- Python
- Stelle
- 685
- Fork
- 70
- Merge medio
- 1m
- PR unite (30g)
- 2
Descrizione
Hi, I stumbled upon this 2 bugs while trying out your project. It seems to me that those 2 functions that present the issue (`actions.download_workflow_run_logs` and `actions.list_jobs_for_workflow_run`) are working under the assumption that they're going to receive json, which is not the case. The first will receive a zip file (in the form of a byte array), while the second will receive the raw logs in the body of the response.
To reproduce:
```python
from ghapi.all import GhApi
api = GhApi(owner='fastai', repo='fastcore')
res_runs = api.actions.list_workflow_runs_for_repo(status='completed',per_page=5,page=1) # last 5 workflow_runs of your proj
for run in res_runs.workflow_runs.items:
try:
res = api.actions.download_workflow_run_logs(run.id) # gets a zip (byte array)
except Exception as bug1:
print(bug1)
res_jobs = api.actions.list_jobs_for_workflow_run(run_id=run.id)
for job in res_jobs.jobs.items:
try:
res = api.actions.download_job_logs_for_workflow_run(job.id) # gets plain text
except Exception as bug2:
print(bug2)
```
The problem to me seems that the `urlsend()` method in the fastcore dependency does not care about the response type, but tries to json decode the content, no matter what. Which fails because the `Content-Type` is, respectively, `plain/text` and `application/zip`
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con i wrapper actions.download_workflow_run_logs, list_jobs_for_workflow_run e download_job_logs_for_workflow_run, quindi esegui lo script di riproduzione dell’issue. Esamina la gestione da parte di urlsend() di fastcore delle risposte application/zip e di testo semplice; il lavoro è completato quando entrambi i wrapper restituiscono i corpi delle risposte grezzi senza errori di decodifica JSON.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github, openapi, python
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100