Package: threema.gateway
threema-gatewayis a Python 3 module for the Threema gateway service.
This API can be used to send and receive text messages to and from any Threema
user.NoteOn machines where Python 3 is not the default Python runtime, you should
usepip3instead ofpip.Prerequisites$sudoapt-getinstallpython3python3-pipWe recommend usingvenvto create an isolated Python environment:$pyvenvvenvYou can switch into the created virtual environmentvenvby running
this command:$sourcevenv/bin/activateWhile the virtual environment is active, all packages installed usingpipwill be installed into this environment.To deactivate the virtual environment, just run:$deactivateIf you want easier handling of your virtualenvs, you might also want to
take a look atvirtualenvwrapper.InstallationIf you are using a virtual environment, activate it first.Install the module by running:$pipinstallthreema.gatewayThe dependencylibnaclwill be installed automatically. However, you
may need to installlibsodiumforlibnaclto work.Command Line UsageThe scriptthreema-gatewayprovides a command line interface for
the Threema gateway. Run the following command to see usage information:$threema-gateway--helpExamplesYou can find a few example scripts in theexamples/directory.Note that most of them need to be adjusted to at least add your gateway ID
credentials before they run successfully.Feature LevelsLevelTextCapabilitiesImageFileCredits1X2XXXX3XXXXXYou can see the implemented feature level by invoking the following
command:$threema-gatewayversionContributingIf you want to contribute to this project, you should install the
optionaldevrequirements of the project in an editable environment:$gitclonehttps://github.com/threema-ch/threema-msgapi-sdk-python.git$cdthreema-msgapi-sdk-python$pipinstall-e.[dev]Before creating a pull request, it is recommended to run the following
commands to check for code style violations (flake8), optimise
imports (isort) and run the project’s tests:$flake8.$isort.$py.testYou should also run the type checker that might catch some additional bugs:$mypysetup.pytestsexamplesthreemaReporting Security IssuesPlease report security issues directly to one or both of the following
contacts:Danilo BargenEmail:mail@dbrgn.chThreema: EBEP4UCAGPG:EA456E8BAF0109429583EED83578F667F2F3A5FALennart GrahlEmail:lennart.grahl@gmail.comThreema: MSFVEW6CGPG:3FDB14868A2B36D638F3C495F98FBED10482ABA6Changelog7.0.1(2023-02-21)Fix parsing of unknown reception capabilitiesAdd newReceptionCapabilityitemsRemoveReceptionCapabilitiesError(breaking)6.0.0(2022-06-13)General:Add support for Python 3.10Drop support for Python versions below 3.7Major dependencies bump to increase compatibility with other packagesUpdated all tests to work with the newest dependenciesChanged CLI syntax: All commands are nowdash-caseinstead ofsnake_case,
e.g. thesend_e2ecommand is now calledsend-e2e.5.0.0(2021-05-17)Add custom session and session arguments toConnection(#55, #56)Remove thefingerprintandverify_fingerprintarguments, see #55 for a
detailed explanation and how to achieve pinning4.0.0(2021-01-23)General:Drop support for Python versions below 3.6.1.RemoveReceiptType.user_ackafter deprecation. UseReceiptType.user_acknowledgeinstead.Simplifyutil.aio_run. It does not allow for passing a specific event loop
or closing the event loop on completion any longer.Renameutil.aio_run_proxy_decoratortoaio_run_proxy. It now always
creates the class instance within a running event loop.Client:In async mode, creation of theConnectioninstance must now be done within
anasyncfunction.If you have used awithcontext manager block in async mode before, you
must now do this within anasync withasynchronous context manager. No
change is required in blocking mode.Connection.closeis now an async function.Server:The callback server has been refactored and theAbstractCallbackclass has
been removed for more flexibility and control of the underlyingaiohttpserver. Take a look atexamples/callback.pyon how to use it.The callback server CLI has been removed because it was redundant. The
example provides the same functionality.3.1.0(2020-04-21)Add video messageFix slightly off calculation of image byte length3.0.6(2017-09-22)Migrate to aiohttp23.0.5(2017-07-25)Fix to handle newlibnaclexceptions.3.0.4(2017-05-23)Fix CLI3.0.2(2017-05-12)Initial publication on PyPI