python - urllib does not handle # character properly -
i have url looks follows:
http://me:me1234#@localhost:8080/
when run urlparse on url, instead of netlocpath returning me:me1234#@localhost:8080 returns me:me1234.
from six.moves.urllib import parse o=parse.urlparse('http://me:me1234#@localhost:8080/') print o
parseresult(scheme='http', netloc='me:me1234', path='', params='', query='', fragment='@localhost:8080/')
any idea how why failing parse #? think pretty standard url.
it's fragment. need to encode first:
from six.moves.urllib import parse o=parse.urlparse('http://me:me1234%23@localhost:8080/') print o
this should work needs.
Comments
Post a Comment