
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Opengate-data is a python library that helps you integrate OpenGate into your python projects.
To install the library, run:
pip install opengate-data
To import the OpenGateClient, use:
from opengate_data import OpenGateClient
To initialize the OpenGateClient using a username and password:
client = OpenGateClient(url="Url", user="User", password="Password")
To initialize the client using an api_key:
client = OpenGateClient(url="Url", api_key="Api_Key")
To initialize the client using a token_jwt with a .env file.
Create a .env file with the following content:
TOKEN_JWT="token_jwt"
Load the environment variable and initialize the client:
client = OpenGateClient()
By default, if you use OpenGateClient without parameters, and you set the environment variable TOKEN_JWT, OpenGateClient will be created with this value Iy you want to use TOKEN_JWT from environment, you may delete API_KEY variable environment
To initialize the client using a token_jwt from an environment variable, you can set the token_jwt directly in your environment without relying on a .env:
Create environment variable
On UNIX systems, use:
export TOKEN_JWT="token_jwt"
On Windows, use:
set TOKEN_JWT="token_jwt"
Initialize the client.
client = OpenGateClient()
Similar to the previous example, if you use OpenGateClient without parameters, and you set the environment variable TOKEN_JWT, OpenGateClient will be created with this value Iy you want to use TOKEN_JWT from environment, you may delete API_KEY variable environment
To initialize the OpenGateClient without specifying a URL, you can either omit the URL parameter or set it to None
client = OpenGateClient(api_key="Api_Key")
# or
client = OpenGateClient(url=None, api_key="Api_Key")
Similar to the previous examples, you have the option to provide the api_key directly, set it to None, or omit it altogether. If you choose to omit it, the client will automatically retrieve the api_key from the environment variable if it is set. Additionally, you can also authenticate using a username and password by specifying those credentials instead.
The library consists of the following modules:
The full API documentation for all modules is available at docs/documentation.md
The examples of the different modules are found in the path docs/basic_examples.md
For more details and examples about each of the modules, consult the complete documentation.
To upload your package to PyPI, follow these steps:
Create the .pypirc file in your home directory and add your PyPI token.
notepad $env:USERPROFILE\.pypirc
.nano ~/.pypirc
.Inside the .pypirc file, configure the following lines, replacing token with your actual PyPI API token:
[pypi]
username = __token__
password = token
Before publishing the package, you must generate the documentation files used by the distribution.
First, install the required tool:
pip install pydoc-markdown
Then generate the documentation by running:
./generate_doc.sh
This will create or update docs/documentation.md with the latest docstrings from your codebase.
Open the setup.py file and modify the version field:
version="1.x.x",
Make sure the version is updated according to semantic versioning.
If you haven't already:
pip install twine
Run the following script to build and upload the package:
./dist.sh
Before running tests, make sure to install the necessary testing libraries. You can install them using:
pip install pytest pandas pytest-bdd
If you want to run all the tests (unit and integration), make sure you are in the root of the project (where pytest.ini is located), then run: pytest
This will discover and run all test files matching the pattern defined in pytest.ini
.
Unit tests are located under:
opengate_data/test/unit/
Each subfolder corresponds to a module (e.g., search, collect, rules, etc.).
To run a specific unit test:
pytest opengate_data/test/unit/search/test_datasets.py
Or to run only one class or method:
pytest opengate_data/test/unit/search/test_datasets.py::TestSearchingDatasets
pytest opengate_data/test/unit/search/test_datasets.py::TestSearchingDatasets::test_with_select_simple
If your project uses Gherkin .feature files, install the plugin:
pip install pytest-bdd
Then you can run BDD tests like any other:
pytest opengate_data/test/features/
This project is licensed under the MIT License.
FAQs
description
We found that opengate-data 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.