Hello everyone! This is my first time using the Python Tutor myself, so I apologize in advance if I've done this wrong.
Here is what I'm trying to do. I have a script written in Python 3 that will go through my companies Slack account and delete any files older than 30 days. I've ran this script successfully once before (about a month ago) and when I tried to run the script today to delete more files, I'm given this error: File "C:\Users\malco\Anaconda3\Lib\Slack-File-Delete.py", line 6 _token = xoxp-14301025207-14298191955-14452030292-********** SyntaxError: invalid syntax Below I will attach all of the code for this script. I have changed the end of the token to *'s to protect that information. If I've forgotten to include any information please let me know! Code: import requests import json import calendar from datetime import datetime, timedelta _token = xoxp-14301025207-14298191955-14452030292-********** _domain = oasis-vape.slack.com if __name__ == '__main__': while 1: files_list_url = 'https://slack.com/api/files.list' date = str(calendar.timegm((datetime.now() + timedelta(-30)) .utctimetuple())) data = {"token": _token, "ts_to": date} response = requests.post(files_list_url, data = data) if len(response.json()["files"]) == 0: break for f in response.json()["files"]: print "Deleting file " + f["name"] + "..." timestamp = str(calendar.timegm(datetime.now().utctimetuple())) delete_url = "https://" + _domain + ". slack.com/api/files.delete?t=" + timestamp requests.post(delete_url, data = { "token": _token, "file": f["id"], "set_active": "true", "_attempts": "1"}) print "DONE!" ----------------------------------- ----------------------------------- Malcolm Boone *Vice President* *Oasis Vape* *CONFIDENTIALITY NOTICE -- This email is intended only for the person(s) named in the message header. Unless otherwise indicated, it contains information that is confidential, privileged and/or exempt from disclosure under applicable law. If you have received this message in error, please notify the sender of the error and delete the message. Thank you. * _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor