0

I am having some issues passing multiple variables into the python urllib module.

from urllib.parse import quote_plus as urlquote
PASS='test1'
FAIL='test2'
VAR1 = ('test1:%s' % (urlquote((PASS))))
#VAR2 = ('%s:%s' % (urlquote((FAIL,FAIL))))
print(VAR1)
#print(VAR2)

When i run the script as is with the VAR2 variable commented out, i get the expected result with is

test:test1

Unfortunately when i run it with VAR2 line uncommented, i get the error below

TypeError: quote_from_bytes() expected bytes 

The expected result should be

test1:test1
test2:test2

1 Answer 1

1

I figured it out

from urllib.parse import quote_plus as urlquote
PASS='test1'
FAIL='test2'
VAR1 = ('test1:%s' % (urlquote(PASS)))
VAR2 = ('%s:%s' % (urlquote(FAIL),urlquote(FAIL)))
print(VAR1)
print(VAR2)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.