https://github.com/xoolive/pyb2b
Python API to EUROCONTROL NM B2B services
https://github.com/xoolive/pyb2b
Last synced: about 1 year ago
JSON representation
Python API to EUROCONTROL NM B2B services
- Host: GitHub
- URL: https://github.com/xoolive/pyb2b
- Owner: xoolive
- License: mit
- Created: 2023-07-21T15:15:44.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-21T14:18:53.000Z (over 1 year ago)
- Last Synced: 2025-03-24T07:57:07.651Z (about 1 year ago)
- Language: Python
- Size: 694 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Python API to EUROCONTROL NM B2B services
## Installation
```sh
poetry install
```
## Get started
> [!IMPORTANT]
> You have to own a B2B certificate granted by EUROCONTROL to get access to this data.
You must provide a config file with your key and password to use pyb2b.
```text
[global]
pkcs12_filename = path/to/your/p12/file
pkcs12_password = your_password
mode = OPS/PREOPS
version = 26.0.0
```
This file must be placed in the user_config_dir.
- on linux: `~/.config/b2b/b2b.conf`
- on mac: `~/Library/Application Support/b2b/b2b.conf`
- on windows: `C:\\Users\\\\AppData\\Local\\\\`
Then you may run a text-user interface:
```sh
poetry run b2b
```
## Python interface
The client is also available programmatically (Python):
```python
from pyb2b import b2b
```
> [!WARNING]
> Documentation is still very limited:
>
> - Functions are self documented, listed through autocompletion
> - Most functions return a structure with a JSON object fully typed (for autocompletion in modern editors)
> - All functions have an asynchronous version (with the `async_` prefix)
Asynchronous functions take a `httpx.AsyncClient` as a first argument, to be called as follows:
```python
import httpx
from pyb2b import b2b
async with httpx.AsyncClient(verify=b2b.context) as client:
result = await b2b.async_...(
client, # and extra arguments
)
```