Documentation - nythepegasus/pushover-client GitHub Wiki

Data

Some different data the package provides for ease of use with the classes.

SOUNDS = [
    "pushover",
    "bike",
    "bugle",
    "cashregister",
    "classical",
    "cosmic",
    "falling",
    "gamelan",
    "incoming",
    "intermission",
    "magic",
    "mechanic",
    "pianobar",
    "siren",
    "spacealarm",
    "tugboat",
    "alien",
    "climb",
    "persistent",
    "echo",
    "updown",
    "vibrate",
    "none"
]

PRIORITIES = [
    -2,
    -1,
    0,
    1,
    2
]

ATTACHMENT_TYPES = [
    "image/jpeg",
    "image/png"
]

Classes

class Message

This provides all of the attributes that a Message object contains.

  • message: This is a required argument that can be 1024 4-byte Unicode characters long. It's the main body of the Message that is sent through the client, and can contain HTML formatted text.
  • title: This is an optional argument that can be 250 characters long. It's the title of the Message that is sent through the client. It is plain text.
  • _attachment: This is an optional argument that is a string that points to a specific image file. The image file must be a png or jpeg file, and also must be at most 2.5MB in size.
  • device: This is an optional argument that can specify which device to send the Message to specifically.
  • url: This is an optional argument to provide a supplementary URL that can have a maximum of 512 characters long.
  • url_title: This is an optional argument to provide a title for the supplementary URL that can have a maximum of 100 characters long.
  • priority: This is an optional argument to specify the priority of the Message. The value range is from PRIORITIES, with 2 being an emergency.
  • sound: This is an optional argument to specify the sound to be played when delivering the Message.
  • retry: This is a semi-optional argument that only needs to be set if the priority is 2. It's the amount of seconds to retry sending the Message, with a minimum of 30 seconds.
  • expire: This is a semi-optional argument that only needs to be set if the priority is 2. It's the amount of seconds to stop the retrying of sending the Message, with a maximum of 10800 seconds (3 hours).
  • _api_callback: This is a property which provides the API callback URL for Messages.
  • response_data: This is a property which is set after the Message has been sent through the API. It contains the requests Response the API returned for the Message.
  • attachment: This is a read-only property that returns either an empty string (if there is no attachment specified) or the correct dictionary to be sent through the API to add an attachment.
  • json: This is a read-only property that returns a dictionary that is correctly formatted to be sent through the API.

class Glance

This provides all the attributes that a Glance object contains.

  • title: This is an optional argument that is 100 characters of plaintext to be displayed as the title on the Pushover widget.
  • text: This is an optional argument that is 100 characters of plaintext to be displayed on the Pushover widget.
  • subtext: This is an optional argument that is 100 characters of plaintext to be displayed on the Pushover widget's second line.
  • count: This is an optional argument that can be either a positive or negative integer to be displayed on the Pushover widget.
  • percent: This is an optional argument that can be an integer between 0 and 100 to be displayed on the Pushover widget.
  • _api_callback: This is a property which provides the API callback URL for Glances.
  • response_data: This is a property which is set after the Glance has been sent through the API. It contains the requests Response the API returned for the Glance.
  • json: This is a read-only property which returns a dictionary that is correctly formatted to be sent through the API.

class Client

This provides all the attributes and methods that a Client object contains.

  • user_key: A required argument that specifies the Client's user_key. Found on the Pushover homepage.
  • api_token: A required argument that specifies the Client's api_token. Found after you have created an application on Pushover.
  • last_message: A property which contains the last message the Client object has sent. Useful to find the Message/Glance's response_data.
  • _api_url: A property which contains the base URL for the Pushover API.
  • _api_verify: A property which contains the URL path to the Pushover API's validation URL path.
  • _api_limits: A property which contains the URL path to the Pushover API's limits URL path.
  • _api_receipts: A property which contains the URL path to the Pushover API's receipts URL path.
  • verify_user

    A class method used to verify that the Client object has been provided the correct user_key and api_token

    • returns: It returns a requests Response the API returns after checking the current user_key and api_token.
  • get_limits

    A class method used to get the current application's limits using api_token

    • returns: It returns a requests Response the API returns after checking the limits of the current application.
  • send

    A class method used to send either a Message or Glance object through the API.

    • returns: It returns a requests Response the API returns after sending the Message.
  • get_receipt: receipt: Manual argument of the receipt a priority 2 Message returns

    A class method used to get receipt of a priority 2 Message

    • returns: It returns a requests Response the API returns after checking the status of the Message.