Hello
i have multiple users in "user management" and i need to change the domain @TEST.com to testy.com for +1000 users and i found a script python but don't worked
this is script pyhton
---------------------START SCRIPT-----------------------------------------
import requests
import csv
JIRA_EMAIL = 'xxxxxxx@xxxxxx.com'
JIRA_API_TOKEN = 'xxxxx-TOKEN-XXXXX'
CSV_FILE = r'C:\Users\XXXXX\Documents\import-users.csv'
print("JE LIS LE FICHIER")
OLD_DOMAIN = '@test.com'
NEW_DOMAIN = '@testy.com'
with open(CSV_FILE, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
old_email = row['email'] # Colonne de l'email existant dans le CSV
if OLD_DOMAIN in old_email:
new_email = old_email.replace(OLD_DOMAIN, NEW_DOMAIN)
payload = {
"emailAddress": new_email
}
response = requests.put(url, json=payload, auth=(JIRA_EMAIL, JIRA_API_TOKEN))
if response.status_code == 204:
print(f"L'email de {old_email} a été mis à jour avec succès en {new_email}.")
else:
print(f"Erreur pour {old_email}: {response.status_code} - {response.text}")
else:
print(f"Aucune modification nécessaire pour {old_email}.")
------------------ END SCRIPT---------------------
have you another idea for i can do this ?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.