Skip to main content

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


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.5b1.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

a7p-0.0.5b1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file a7p-0.0.5b1.tar.gz.

File metadata

  • Download URL: a7p-0.0.5b1.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for a7p-0.0.5b1.tar.gz
Algorithm Hash digest
SHA256 2d6ca99ebe40e2df29ad4a8de51cc50d2c7a500513d4197eea671e2c80dbd3e0
MD5 369dc0bc8aa316d96eadfce16f3e9ef9
BLAKE2b-256 a770cc44b83eca336172a97086a24f0bbc50be49bae72f36054338431e1ee8a9

See more details on using hashes here.

File details

Details for the file a7p-0.0.5b1-py3-none-any.whl.

File metadata

  • Download URL: a7p-0.0.5b1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for a7p-0.0.5b1-py3-none-any.whl
Algorithm Hash digest
SHA256 b326fa995e1acbadef9a5a29885405d2880c4f4ce9eda5a0441be7c539f1bd4b
MD5 9370e94727824b419452bfb39976404d
BLAKE2b-256 e9e61fd583f5ea9775daa94a6ee751fe766e03be67acd024d4a07bf6163554c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page