#!/usr/bin/python
# coding=utf-8
import time
from selenium import webdriver
import xlsxwriter
from Data_tags import Inventory_data
driver = webdriver.Chrome('/Users/Martin/Desktop/chromedriver')
def run(d):
login("Usuario", "pass")
NewTag("https://platform/en/users/inventory/create")
Device = str(d.get("Li_platform")) #Mobile Web
Inicio_Li_Platform = ('//*[@id="platform_listbox"]/li[')
Final_Li_Platform = (']')
Platform(Inicio_Li_Platform+""+Device+""+Final_Li_Platform)
NameTag(d.get("TagName"))
Floor_Rate(d.get("Floor_price"))
Save_Tag('save')
Save_xlsx(d.get("Excel_name"))
Inicio_Li_Publisher = ('//*[@id="publisher_listbox"]/li[')
Final_Li_Publisher = (']')
Publisher = str(d.get("Li_Publisher")) #Publisher Altitude
Publisher_Li(Inicio_Li_Publisher+""+Publisher+""+Final_Li_Publisher)
Tag_Rate_and_Save(d.get("Tag_Rate"))
time.sleep(2)
driver.close()
def main():
while True:
tag = input("Ingrese la clave deseada, nada para salir: ")
if not tag:
break
d = (Inventory_data.get("Inventario_datos")).get(tag, None)
if d:
run(d)
else:
print("Clave no encontrada.")
main()
This is a part of my code with which I can enter a value through the terminal which serves to execute my program. This value remains in my variable ( d = (Inventory_data.get("Inventario_datos")).get(tag, None)
).
So far the program runs perfect, but I need to enter more than one value at a time. Every time I enter a value the program runs, what I am looking for is that the program be executed for each value that I enter in a single time.
An example to be clearer would be to write in the terminal "auto", "truck", "bicycle" and that the program execute all functions for auto, once you finish with car, do the same with truck and so on with all the other values.
Thanks