Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E.
Supported utilities (in alphabetical order):
To add support for a new utility that uses opower JSON API (you can tell if the energy dashboard of your utility makes network requests to opower.com, e.g. pge.opower.com in the network tab of your browser's developer tools) add a file similar to pge.py or pse.py or bge.py etc.
Name the file after the utility website, e.g. pge.py for pge.com.
Since this library is used by Home Assistant, see https://www.home-assistant.io/integrations/opower/, per https://github.com/home-assistant/architecture/blob/master/adr/0004-webscraping.md we cannot have a dependency on a headless browser and we can only parse HTML during login.
An exception is made for the authentication phase. An integration is allowed to extract fields from forms. To make it more robust, data should not be gathered by scraping individual fields but instead scrape all fields at once.
So follow that advice and try to scrape all fields at once, similar to the get_form_action_url_and_hidden_inputs
in helpers.py.
python3 -m venv .venv
source .venv/bin/activate
# for Windows CMD:
# .venv\Scripts\activate.bat
# for Windows PowerShell:
# .venv\Scripts\Activate.ps1
# Install dependencies
python -m pip install --upgrade pip
python -m pip install .
# Run pre-commit
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
# Alternative: run formatter, lint, and type checking
python -m pip install isort black flake8 ruff mypy
isort . ; black . ; flake8 . ; ruff check . --fix ; mypy --install-types .
# Run tests
python -m pip install pytest python-dotenv
pytest
# Run command line
python -m opower --help
# To output debug logs and API responses to a file run:
python -m opower -vv 2> out.txt
# Build package
python -m pip install build
python -m build
FAQs
A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
We found that opower demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.