Support building query without values
- 主要言語
- Python
- スター
- 1.5k
- フォーク
- 215
- 平均マージ
- 1日 2分
- マージ済み PR(30日)
- 13
説明
Sometimes query consists not only of pairs of keys and values but also can contain standalone keys. In my opinion, it's bad, but I encountered this a few times in different APIs.
For example, I need to build a URL like: https://api.crowdin.com/api/project/{project_identifier}/pre-translate?key={project_key}&json (see https://support.crowdin.com/api/pre-translate/ for details).
I propose to make an interface look like this:
```python
url = URL('https://api.crowdin.com/api/project/{project-identifier}/pre-translate')
url = url.with_query(key=project_key, json=None)
```
This is safe because now passing `None` as keyword argument value raises `TypeError`. If user wants to get an URL with `json=` (note that the last symbol is the equals sign), he passes `json=''` as he does now.
コントリビューションガイド
評価
この issue はまだ評価されていません。