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# - ItextSharp font color issue in ver 5.5.4+ -

ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -