Skip to content

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

@fedxyz

Description

@fedxyz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions