Skip to content

Instantly share code, notes, and snippets.

@RDIL
Created April 1, 2020 15:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RDIL/268769606c82d12c49a8aae4eba79369 to your computer and use it in GitHub Desktop.
Save RDIL/268769606c82d12c49a8aae4eba79369 to your computer and use it in GitHub Desktop.
Delete any PythonAnywhere log file

Usage

  1. install pythonanywhere with pip
  2. run this file
  3. put the log file names in the prompt one-by-one
  4. you are done!

NOTE: you need to run the file in a pythonanywhere console otherwise it will break.

import pythonanywhere.api
import getpass
while True:
url = pythonanywhere.api.get_api_endpoint().format(
username=getpass.getuser(), flavor="files"
) + "path/var/log/{name}/".format(
name=input("Logfile name: ")
)
response = pythonanywhere.api.call_api(url, "delete")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment