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 theMessage
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 theMessage
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 theMessage
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 theMessage
. 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 theMessage
.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 theMessage
, 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 theMessage
, with a maximum of 10800 seconds (3 hours)._api_callback
: This is a property which provides the API callback URL forMessage
s.response_data
: This is a property which is set after theMessage
has been sent through the API. It contains the requests Response the API returned for theMessage
.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 forGlance
s.response_data
: This is a property which is set after theGlance
has been sent through the API. It contains the requests Response the API returned for theGlance
.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 theClient
's user_key. Found on the Pushover homepage.api_token
: A required argument that specifies theClient
's api_token. Found after you have created an application on Pushover.last_message
: A property which contains the last message theClient
object has sent. Useful to find theMessage
/Glance
'sresponse_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 correctuser_key
andapi_token
returns
: It returns a requests Response the API returns after checking the currentuser_key
andapi_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
orGlance
object through the API.returns
: It returns a requests Response the API returns after sending theMessage
.
get_receipt
:receipt
: Manual argument of thereceipt
a priority 2Message
returnsA 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 theMessage
.