Python Forum
Adding “import sys” to Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding “import sys” to Python
#6
(Oct-17-2020, 09:23 AM)snippsat Wrote: Can pass value into params using f-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 :/
Reply


Messages In This Thread
Adding “import sys” to Python - by Yevgen1991 - Oct-16-2020, 07:23 PM
RE: Adding “import sys” to Python - by Larz60+ - Oct-16-2020, 08:58 PM
RE: Adding “import sys” to Python - by snippsat - Oct-17-2020, 09:23 AM
RE: Adding “import sys” to Python - by Yevgen1991 - Oct-17-2020, 10:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding markers to Folium map only adding last element. tantony 0 2,140 Oct-16-2019, 03:28 PM
Last Post: tantony
  wordpress-python-xmlrpc. I can import 1 file. How do I import the entire folder? SamLearnsPython 0 3,281 Jul-05-2018, 06:21 AM
Last Post: SamLearnsPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020