pgw-api
Python API client for Philadelphia Gas Works (PGW). Fetches monthly natural gas usage data from the PGW customer portal.
Installation
pip install pgw-api
Usage
import asyncio
import aiohttp
from pgw_api import PGWApiClient
async def main():
client = PGWApiClient("your-email@example.com", "your-password")
async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
usage = await client.async_get_usage(session)
for entry in usage:
print(f"{entry.month:%B %Y}: {entry.ccf} CCF ({entry.cf} ft³)")
if entry.period_start and entry.period_end:
print(f" Period: {entry.period_start} to {entry.period_end}")
asyncio.run(main())
API
PGWApiClient(username, password)
Creates a client instance with PGW portal credentials.
await client.async_get_usage(session)
Authenticates and returns a list of GasUsage objects sorted by month (newest first).
await client.async_validate_credentials(session)
Validates credentials without fetching usage data. Returns True or raises PGWAuthError.
GasUsage
| Property | Type | Description |
|---|---|---|
month |
date |
First of the billing month |
ccf |
float |
Usage in hundreds of cubic feet |
cf |
float |
Usage in cubic feet (CCF × 100) |
period_start |
date | None |
Meter read start date |
period_end |
date | None |
Meter read end date |
Exceptions
PGWAuthError— invalid credentials or expired sessionPGWConnectionError— network or portal issuesPGWError— base exception class
Release files for pgw-api 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pgw_api-1.1.0.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgw_api-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / pgw_api-1.1.0.tar.gz
| Download URL | pgw_api-1.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f37ee7b2371ed9a4645b8c99586b20c78f1f19373479e21c05b88208ff68b30
|
|
BLAKE2b-256 checksum How to use checksums |
a674bc23d39598d5a7e6096debca6fb5e3741e2bf25b1e3bff4858a8a1b4e361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / pgw_api-1.1.0-py3-none-any.whl
| Download URL | pgw_api-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c43df60eccf78f0510a7739a6fac9422f66c6f43b34588f2e8ac6ca3dfe0cf7
|
|
BLAKE2b-256 checksum How to use checksums |
a6b4532ac5437f7e62925c15610bc4f39177c098350a19e105f27ebda7b28f93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency log