Skip to main content

APC_Temp_fetch

This python package provides an unified interface to several UPS network adapters with different firmware versions. It does not support guessing which interface to use; that wasn't necessary yet.

It supports the following interfaces:

kind description
old Simple interface using HTTP basic auth, information gets extracted from upsstat.htm, by finding the line mentioning Internal Temperature
frmnc Requires 2 HTTP requests, main characteristics are that the login form is named frmLogin in HTML, and the data is presented in a <div>-table, but parsable line-by-line
frmnc666 Similar to frmnc; with 3 HTTP requests, but the status page is named upstat.htm (which makes the additional HTTP request necessary)
gden-nt07 Similar to frmnc; with 3 HTTP requests, but the login form is named HashForm1 instead, and the data representation is more complex, so a more full-blown HTML-parser is used; data structured via <span> items
cs121 Unauthenticated HTTP API (simply pass - - as <user> <password>), information gets extracted from main.shtml, by parsing _dw and &nbsp; from an HTML table, line-by-line
cs141 Simple JSON API (and the imo best interface of these); with 3 HTTP requests, characteristic is the the data is located at /api/devices/ups/report

The description provides some guidance which kind an interface is. You may also just try out each kind and check if any returns useful results, but (although unlikely) it may "brick" the network adapter until it is reset; usually seen when (thru some bug) the script isn't able to properly logout after a successful login, because many of these network adapters limit the number of concurrent logins, often to even just 1 user at a time.

This package has 2 entry points:

  • APC_Tempf [--verbose] [--proxy <proxy_url>] <kind> <host> <user> <password> [--timeout <timeout>] kind is the one of these mentioned above. host, user and password should be self-explanatory. timeout is an optional per-request timeout. This is the primary, "simple" interface.

  • APC_Tempstfe [--verbose] [--proxy <proxy_url>] <apclist> allows querying multiple UPS devices sequentially, and is used to amortize the python script startup time. The file should contain lines of the format <kind> <host> <user> <password>[ <timeout>] (all without the <> brackets). After the timeout, a comment may be given, or a comment can be alternatively placed at the begging of a line, prefixed with a # ; empty lines are ignored.

Results are formatted as <host>\t<temperature> (<> brackets aren't part of the output, \t is replaced with an ASCII TAB character).

proxy support

If required, --proxy <proxy_url> can be added to the entry point command line to contact all API endpoints through the specified proxy. Note that this might require pip3 install 'requests[socks]' or on Gentoo USE="socks5" emerge -v dev-python/requests to work with SOCKS proxies.

When using the python API, proxies can be specified in the ApcKind.__init__(_, rqa) rqa parameter (see Requests documentation, or the source code in cli.py)

Metadata

Release files for APC-Temp-fetch 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for APC-Temp-fetch 0.0.9
File Size Uploaded
apc_temp_fetch-0.0.9.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for APC-Temp-fetch 0.0.9
File Interpreter ABI Platform
apc_temp_fetch-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / apc_temp_fetch-0.0.9.tar.gz

Download URL apc_temp_fetch-0.0.9.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2266c6513707924f9f4ef6d84534df00163f9f6733002d015e40c0ba6829a01a
BLAKE2b-256 checksum
How to use checksums
7b65ad7c0d360388adb4aa10682e582ffb479d59987f0fb618588cc4f727b21e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / apc_temp_fetch-0.0.9-py3-none-any.whl

Download URL apc_temp_fetch-0.0.9-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ab6c2bb6b17caad24f1e90d487936b342ba0a1ce283da87e9ac48d8a987a61b
BLAKE2b-256 checksum
How to use checksums
3638710eabb55b5a0fc03b7420a748491c888319aa64454772a5d6ef198ad400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page