I have two files with different information that I want to execute simultaneously each line of both files in a loop until it finishes, but the "name" is stuck in the first lines and the "id" executes normally.
def get_data(account_id,key):
name_entity = open('C:/Graphiql/Alerts/Update Alerts Policy/map/name','r')
id_alerts = open('C:/Graphiql/Alerts/Update Alerts Policy/map/id_alerts','r')
for entity in name_entity:
name = entity.strip('\n')
for alerts in id_alerts:
id = alerts.strip('\n')
endpoint = "https://api.newrelic.com/graphql"
head = {"Content-type": "application/json", 'api-Key': f'{key}'}
payload = 'mutation {alertsNrqlConditionStaticUpdate(accountId: ' + str(account_id) + ', condition: {nrql: {query: "SELECT average(memoryFreeBytes) FROM SystemSample where hostname = \u0027' + str(name) + '\u0027"}}, id: ' + str(id) + ') {id}}'
I've already changed the order and changed the functions but that doesn't work.