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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -