Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions notecard/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def auxSerial(card, duration=None, limit=None, max=None, minutes=None, mode=None
card (Notecard): The current Notecard object.
duration (int): If using `"mode": "accel"`, specify a sampling duration for the Notecard accelerometer.
limit (bool): If `true`, along with `"mode":"gps"` the Notecard will disable concurrent modem use during GPS tracking.
max (int): The maximum amount of data to send per session, in bytes. This is typically set to the size of the receive buffer on the host minus `1`. For example, `note-arduino` uses a buffer size of `(SERIALRXBUFFER_SIZE - 1)`.
max (int): The maximum amount of data, in bytes, that can be sent in a single transmission before the Notecard pauses to allow the host to process incoming data. This value should be set to the size of the host's serial receive buffer minus `1`, which represents the number of bytes the host can absorb before the sender must delay due to the absence of flow control. For example, `note-arduino`` uses a buffer size of `(SERIALRXBUFFER_SIZE - 1)`.
minutes (int): When using `"mode": "notify,dfu"`, specify an interval for notifying the host.
mode (str): The AUX mode. Must be one of the following:
ms (int): The delay in milliseconds before sending a buffer of `max` size.
Expand Down Expand Up @@ -799,7 +799,7 @@ def triangulate(card, minutes=None, mode=None, on=None, set=None, text=None, tim

@validate_card_object
def usageGet(card, mode=None, offset=None):
"""Return the card's network usage statistics.
"""Return the Notecard's network usage statistics for cellular and Wi-Fi transmissions.

Args:
card (Notecard): The current Notecard object.
Expand All @@ -819,13 +819,13 @@ def usageGet(card, mode=None, offset=None):

@validate_card_object
def usageTest(card, days=None, hours=None, megabytes=None):
"""Calculate a projection of how long the available data quota will last based on the observed usage patterns.
"""Calculate a projection of how long the available cellular data quota will last based on the observed usage patterns.

Args:
card (Notecard): The current Notecard object.
days (int): Number of days to use for the test.
hours (int): If you want to analyze a period shorter than one day, the number of hours to use for the test.
megabytes (int): The Notecard lifetime data quota (in megabytes) to use for the test.
megabytes (int): The Notecard lifetime cellular data quota (in megabytes) to use for the test.

Returns:
dict: The result of the Notecard request.
Expand Down
5 changes: 4 additions & 1 deletion notecard/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,13 @@ def post(card, async_=None, binary=None, body=None, content=None, file=None, max


@validate_card_object
def put(card, async_=None, body=None, content=None, file=None, max=None, name=None, note=None, offset=None, payload=None, route=None, seconds=None, status=None, total=None, verify=None):
def put(card, async_=None, binary=None, body=None, content=None, file=None, max=None, name=None, note=None, offset=None, payload=None, route=None, seconds=None, status=None, total=None, verify=None):
"""Perform a simple HTTP or HTTPS `PUT` request against an external endpoint, and returns the response to the Notecard.

Args:
card (Notecard): The current Notecard object.
async_ (bool): If `true`, the Notecard performs the web request asynchronously, and returns control to the host without waiting for a response from Notehub.
binary (bool): If `true`, the Notecard will send all the data in the binary buffer to the specified proxy route in Notehub. Learn more in this guide on Sending and Receiving Large Binary Objects.
body (dict): The JSON body to send with the request.
content (str): The MIME type of the body or payload of the response. Default is `application/json`.
file (str): The name of the local-only Database Notefile (`.dbx`) to be used if the web request is issued asynchronously and you wish to store the response.
Expand All @@ -180,6 +181,8 @@ def put(card, async_=None, body=None, content=None, file=None, max=None, name=No
req = {"req": "web.put"}
if async_ is not None:
req["async"] = async_
if binary is not None:
req["binary"] = binary
if body:
req["body"] = body
if content:
Expand Down