Search code examples
pythonurlurl-pattern

Unable to send two params in URL path to python


I'm using pythons in backend and i like to get some data through URL, simply i can say as through REST. My URL works with single param but fails for two params. Please refer below two URL

Single param:

curl -XPUT -HContent-type:text/plain --data "stuff:morestuff"  <URL>?attr1=testvalue

Two param:

curl -XPUT -HContent-type:text/plain --data "stuff:morestuff"  <URL>?attr1=testvalue&attr2=133

I cross verify that, python code is correct.


Solution

  • you may missed out escape key() after & in the URL, try this one.... i hope this will work

    curl -XPUT -HContent-type:text/plain --data "stuff:morestuff"  <URL>?attr1=testvalue\&attr2=133
    

    I faced similar problem, it works. make an try and let me know.