Simple python3 wrapper for .a7p files
Project description
Table of Contents
Description
Simple python3 wrapper for .a7p files
Instalation
As common from PyPi:
pip install a7p
or latest from repository:
git clone https://github.com/o-murphy/a7p_transfer_example
cd a7p_transfer_example/a7p_py
python setup.py install
This command builds the Docker image and tags it as go-server
.
Usage
import logging
from a7p import A7PFile, A7PDataError
from a7p.factory import A7PFactory
# open file in binary mode
with open('data/test.a7p', 'rb') as fp:
# read data from file
try:
profile_opj = A7PFile.load(fp)
except A7PDataError as exc: # raises if md5 crc not match
logging.error(exc)
# accessing attributes as for default protobuf payload
profile_name = profile_opj.profile.profile_name
# data conversion to common types
as_json = A7PFile.to_json(profile_opj)
as_dict = A7PFile.to_dict(profile_opj)
from_json = A7PFile.from_json(profile_opj)
from_dict = A7PFile.from_dict(profile_opj)
# saving builded profile
with open('data/test.a7p', 'rb') as fp:
A7PFile.dump(profile_opj, fp)
# creating a new a7p Payload
payload = A7PFactory(
meta=A7PFactory.Meta(
name="test profile name",
),
bullet=A7PFactory.Bullet(
weight=175,
length=0.9
),
distances=A7PFactory.DistanceTable.LONG_RANGE
)
with open('data/test.a7p', 'rb') as fp:
A7PFile.dump(payload, fp)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
a7p-0.0.3.tar.gz
(21.3 kB
view details)
Built Distribution
a7p-0.0.3-py3-none-any.whl
(21.3 kB
view details)
File details
Details for the file a7p-0.0.3.tar.gz
.
File metadata
- Download URL: a7p-0.0.3.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27bdf502aec0c412eb3349b4c76ef6b546cafe278eca2cde09ec34f3d42b9922 |
|
MD5 | c4a5a331277fbf135d5a93c166ff8b81 |
|
BLAKE2b-256 | 8d85a16d3e31854834d9c12f5e3c9b58d6f175fccd478fc446a332a71a37c3f7 |
File details
Details for the file a7p-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: a7p-0.0.3-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4683a018d3e5157af292eb7f69aba7ca127c51da90a4f3c59346a98fc18c235 |
|
MD5 | 3bd7beaed084381a0ce08c1ecf3e6aaf |
|
BLAKE2b-256 | 4711117cbbd5507bf95c3e066255f07b27a6b3f1022979919d8554d0ab9671ea |