gruns / furl

🌐 URL parsing and manipulation made easy.
Other
2.6k stars 151 forks source link

Setting multiple query params for the same key and resultant url format #162

Open fedxyz opened 1 year ago

fedxyz commented 1 year ago

Hi,

I a bit confused how to create an url with multiple query params with the same key, (I was reading an old issue #69)

this one works:

f = furl("https://example.com").add(path=["path1", "path2"])
f.args.setlist('foobar', ["one", "two"])
print(f.url)
# gives https://example.com/path1/path2?foobar=one&foobar=two

but this too works

f = furl("https://example.com").add(path=["path1", "path2"])
f.args["foobar"] = ["one", "two"]
print(f.url)
# gives https://example.com/path1/path2?foobar=one&foobar=two

What is the right way to setting multiple query params for the same key?

About the resultant url, can I be sure it that the multiple query params for the same key will be always in the format foobar=one&foobar=two and not in the format foobar=one,two ?

Thanks for the help.