Package: a1pamfax
a1pamfaxAirport1's PamFax - short namea1pamfax- is a Python (3.6+) package that implements thePamFaxAPI.This is an adaption ofDynaptico PamFax (Python2)- once written for Python 2 - now adapted to work for Python 3.6 or later.
The old code (and style) has been kept whenever possible, on purpose. The behavior should be nearly the same.For more information about the PamFax API, visit:PamFax for Developers.As this package is still in development, please report any bugs or issues by raising an issue in thisGithubrepository.This module is written for Python 3.6+ and has only been tested against Python 3.9.
There is a big chance it works for previous versions, however, too.InstallationYou can installa1pamfaxeither via the Python Package Index (PyPI) or from source.To install the latest version via pip:pip install a1pamfax --upgradeThis is my first public package following the instructions onPython-Packaging.
So far I included the test, test data (the former pdf file by dynaptico), a config example and a sample.RequirementsIt is required to install at least (e.g. viapip install requests):requestsTestsIt is strongly recommended to use the sandbox environment ('sandbox-apifrontend') for testing.
First copy the fileconfig.example.pyand rename it toconfig.pyand fill in your credentials. Then
run either the sample by:python sample.pyor the test suite by:cd test
python test.pyYou may adapt the main method oftest.pyto en-/disable the tests you (dis)like.Depending on the tests you run it might be required that you already received or sent something, e.g. in the
sandbox environment.
The online storage tests will partially be skipped if you did not authenticate for e.g. Dropbox before, this
is intentionally.UsageThere is also asample.pyprovided, but in short: after logging in follow thePamFax Processors Documentation. E.g. Common::GetCurrentSettings is available as
pamfax.get_current_settings() etc. Full example:from config import HOST, USERNAME, PASSWORD, APIKEY, APISECRET
from pamfax import PamFax

pamfax = PamFax(USERNAME, PASSWORD, host=HOST, apikey=APIKEY, apisecret=APISECRET)
response = pamfax.get_current_settings()
print(response)DocumentationThere is no documentation for this package in Python 3 yet. But:
the documentation for the older Python 2 implementation by dynaptico might be still available here:Dynaptico PamFax documentation (Python2)and nearly all methods and signatures have been kept ON PURPOSE,
just adapted for Python 3. Only few private methods were changed.See also section Particularities.IntegrityAll methods in the PamFax API should be implemented by this package, except the ones introduced after Dynaptico
released his Python 2 version. Missing methods will be added, step by step.Since v0.0.6 Dropbox methods are re-enabled and tested, plus missing methods for Common have been added.ParticularitiesAs said, the code is heavily based on an old package for Python 2. It was just adapted to run "the same" on Python 3.
Intentionally nearly all methods and signatures have been kept, except the implementation might be different sometimes.
So the code has only been touched where it was required, e.g. it's using nowrequests's session with a timeout
of 30 seconds.
I tried to stick to the coding style of dynaptico.
However, few private methods had to be changed in their signature:_get_and_check_response_get_postThanksTo Dynaptico, on which this rewrite for Python 3 is heavily based on, see:Dynaptico PamFax (Python2).Packaging for Python - a small tutorialFor developing ensure the package is uninstalled e.g. in the venv and in test.py setdevelop_mode = True:pip uninstall a1pamfaxPre-testing: in test.py setdevelop_mode = False, then for e.g. in the venv do this:python setup.py install
python test.pyIn general check outPython-Packaging. After setting up the Test-PyPI and PyPI accounts continue here.cd \workspace\python\a1pamfax
rd /s /q dist build a1pamfax.egg-info
python -m pip install --user --upgrade setuptools wheel
python setup.py sdist bdist_wheel
python -m pip install --user --upgrade twineUploading to testpypi:python -m twine upload --repository testpypi dist/*And after testing, for production use (e.g. in the venv):python -m twine upload dist/*
pip uninstall a1pamfax
pip install a1pamfax --upgrade