Closed amarynets closed 4 years ago
I tried to do it with requests
lib and it doesn't unquote %3B
same problem with "&" symbol. Example url: https://www.pier1.com/christopher-metallic-jacquard-indigo-%26-gold-pillow/3498618.html URL._PATH_QUOTER convert "%26" to "&" symbol, and make bad url https://www.pier1.com/christopher-metallic-jacquard-indigo-&-gold-pillow/3498618.html
The issue was solved by this code URL(url, encoded=True)
In aiohttp you can pass URL object or string. The string was already encoded
File "/home/blh/.local/lib/python3.5/site-packages/homeassistant/components/frontend/__init__.py", line 8, in <module>
from aiohttp import web
File "/home/blh/.local/lib/python3.5/site-packages/aiohttp/web.py", line 14, in <module>
from . import (hdrs, web_exceptions, web_fileresponse, web_middlewares,
File "/home/blh/.local/lib/python3.5/site-packages/aiohttp/web_middlewares.py", line 5, in <module>
from aiohttp.web_urldispatcher import SystemRoute
File "/home/blh/.local/lib/python3.5/site-packages/aiohttp/web_urldispatcher.py", line 17, in <module>
from yarl import URL, unquote
ImportError: cannot import name 'unquote'
please why it is?
Because YARL doesn't have unquote
function. It has _Quoter
and _Unquoter
classes, but you shouldn't use it
@beyondwxin
@beyondwxin from your trace aiohttp imports this function, you probably have incompatible versions of yarl and aiohttp. Try upgrading aiohttp.
@beyondwxin from your trace aiohttp imports this function, you probably have incompatible versions of yarl and aiohttp. Try upgrading aiohttp.
I used a newest the aiohttp and yarl version
Please check versions explicitly:
import aiohttp
print(aiohttp.__version__)
import yarl
print(yarl.__version__)
Stale
I have this URL: https://www.madewell.com/9%22-high-rise-skinny-jeans-in-isko-stay-blacktrade%3B-G1202.html which contains
%3B
(;).YARL unquote
%3B
to;
https://www.madewell.com/9%22-high-rise-skinny-jeans-in-isko-stay-blacktrade%3B-G1202.html https://www.madewell.com/9%22-high-rise-skinny-jeans-in-isko-stay-blacktrade;-G1202.htmlWhen I open URL from YARL it redirects me to the homepage. But If I make little changes:
_PATH_QUOTER = _Quoter(safe='@:', protected='/+;')
- add;
to protected parameter - it works correctMy question: Is it issue with YARL or with a site? Thanks