aio-libs / aio-libs/yarl

Make default port substitution work with more schemes

Open
#240 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.5k
Forks
215
Avg merge
1d 2m
Merged PRs (30d)
13

Description

We are using YARL with `mqtt:` and `mqtts:` URLs, for which default ports are not substituted. This means we have to do the substitution manually in our code. This is fragile and easy to forget.

One possibility is to just add substitutions for these schemes (and possibly other common schemes) to YARL directly. This would be straightforward, but I can imagine it could also be a maintenance headache.

Another way would be allowing to extend the list of substitutions as part of the public API. That would allow anyone to add substitutions they need. Right now, this can already be done by modifying `yarl.DEFAULT_PORTS`, but this way is not documented and it also acts globally, meaning it would be bad e.g. for a library which uses YARL internally to do this. A parameter used when creating a URL would probably be a nicer solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.