Websites

class website.Website[source]

Interface for PythonAnywhere websites API.

Uses pythonanywhere_core.base function get_api_endpoint to create url, which is stored in a class variable Website.api_endpoint, then calls call_api with appropriate arguments to execute websites action.

Methods:
auto_ssl(domain_name: str) dict[source]

Creates and applies a Let’s Encrypt certificate for domain_name. :param domain_name: domain name for website to apply the certificate to :return: dictionary with response

create(domain_name: str, command: str) dict[source]

Creates new website with domain_name and command.

Parameters:
  • domain_name – domain name for new website

  • command – command for new website

Returns:

dictionary with created website info

delete(domain_name: str) dict[source]

Deletes website with domain_name. :param domain_name: domain name for website to delete :return: empty dictionary

get(domain_name: str) dict[source]

Returns dictionary with website info for domain_name. :param domain_name: :return: dictionary with website info

get_ssl_info(domain_name) dict[source]

Get SSL certificate info :param domain_name: domain name for website to get SSL info :return: dictionary with SSL certificate info

list() list[source]

Returns list of dictionaries with all websites info. :return: list of dictionaries with websites info

reload(domain_name: str) dict[source]

Reloads website with domain_name. :param domain_name: domain name for website to reload :return: dictionary with response