aio-libs / aio-libs/aiohttp

Changing readers to async iterators

Aperta
#5,911 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
16.5k
Fork
2.4k
Merge medio
17h 22m
PR unite (30g)
212

Descrizione

### Is your feature request related to a problem?

Not problem, but looks legacy

```
while True:
chunk = await field.read_chunk()
if not chunk:
break
```

or

```
reader = await request.multipart()
while True:
field = await reader.next()
if field is None: break
```

### Describe the solution you'd like

```
async for chunk in field.chunks():
f.write(chunk)
```

or

```
async for field in (await request.multipart()):
....
```

### Describe alternatives you've considered

Or fix docs on objects already has __anext__ interface.

### Related component

Server

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow the aio-libs Code of Conduct

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.