Home > Mobile >  how to pass variable to python request for the target
how to pass variable to python request for the target

Time:11-17

I have a data populated for an exclude put curl request to Elastic and it works fine with specifying ip address in my request like below.

data = '{\n "transient" : {\n "cluster.routing.allocation.exclude._ip" : "172.39.1.23"\n }\n}'

I just want to be able to put a variable in stead of ip address and it is not working. I have instip variable set to same string in my python.

data = '{ "transient" : { "cluster.routing.allocation.exclude._ip": instip} }'

but it doesn't like it!

any help appreciated!

-fatdragon

CodePudding user response:

You can try:

data = f'{{ "transient" : {{ "cluster.routing.allocation.exclude._ip": "{instip}"}} }}'
  • Related