import csv import requests def main(): # Base url, path and the instance's cloud id get it from admin.atlassian.net cloud_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' # Open the .CSV file with the users id and email with open('Jira_Users.csv', mode='r') as infile: reader = csv.reader(infile) for row in reader: full_url = "https://admin.atlassian.com/gateway/api/adminhub/um/site/<cloud_id>/users/<user_id>/deactivate" # Print a confirmation of which user it is trying to remove print("Processing removal of id: " + row[0] + " with email: " + row[2]) # Creates a varible with the complete url # Print the full URL just to ensure that we are using the correct one full_url = full_url.replace('<cloud_id>', cloud_id).replace('<user_id>', row[0]) print("Executing url is: " + full_url) # Create request using cookie authentication response = requests.post(full_url, headers={'Cookie': "cloud.session.token=sfasfasdfadsfasETCETCETC.--"}) print(response) if __name__ == '__main__': main()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.