Oct-17-2020, 10:24 AM
(Oct-17-2020, 09:23 AM)snippsat Wrote: Can pass value into params usingf-string
.
import requests import sys sourceip = sys.argv[1] headers = { 'Version': '12.1', 'Accept': 'application/json', } params = ( ('value', f'{sourceip}'), ) response = requests.post('https://prog.example2.com/api/reference_data/sets/virustotalIPs', headers=headers, params=params, auth=('username', 'pass'), verify=False)If Python version is less than 3.6 should upgrade,then can use.format()
like this.
params = ( ('value', '{}'.format(sourceip), )
Not works :/