# python-cpdlc
A simple CPDLC client for flight simulation written by python
## Quick Start
1. install package with pip or any tools you like
```shell
pip install python-cpdlc
```
2. use example code under
By the way, dont forgot to logon your ATC CPDLC first :)
```python
import asyncio
from python_cpdlc import CPDLC
async def main():
# Create CPDLC client instance
cpdlc = CPDLC()
# Set your hoppie code
cpdlc.set_logon_code("11111111111")
# Set your email for network change (If you dont need to change network, you can skip it)
cpdlc.set_email("halfnothingno@gmail.com")
# of course, you can use your own hoppie server
# cpdlc.set_acars_url("http://127.0.0.1:80")
# you can add callback function which will be called when cpdlc connected and disconnected
# there can only be one callback function per event
# cpdlc.set_cpdlc_connect_callback(lambda: None)
# cpdlc.set_cpdlc_disconnect_callback(lambda: None)
# cpdlc.set_cpdlc_atc_info_update_callback(lambda: None)
# you also can add message callback
# cpdlc.add_message_sender_callback()
# cpdlc.add_message_receiver_callback()
# Decorators are recommended unless your callback function is a class method
# @cpdlc.listen_message_receiver()
# def message_receiver(msg: AcarsMessage):
# pass
# @cpdlc.listen_message_sender()
# def message_sender(to: str, msg: str):
# pass
# you should set your callsign before you use CPDLC, and you can change this anytime you like
# but if you change this callsign, you may miss some message send to you
cpdlc.set_callsign("CES2352")
# after set complete, you need to initialize service
cpdlc.initialize_service()
# you can reset service or reinitialize service anytime you like
# cpdlc.reset_service()
# cpdlc.reinitialize_service()
# you can get your current network by cpdlc.network
# you can change your network if necessary
# cpdlc.change_network(Network.VATSIM)
# some function...
# cpdlc.query_info()
# cpdlc.send_telex_message()
# cpdlc.departure_clearance_delivery()
# send login request
cpdlc.cpdlc_login("ZSHA")
# wait 60 seconds
await asyncio.sleep(60)
# request logout
cpdlc.cpdlc_logout()
if __name__ == "__main__":
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": null,
"name": "python-cpdlc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "CPDLC, python, httpx",
"author": null,
"author_email": "Half_nothing <Half_nothing@163.com>",
"download_url": "https://files.pythonhosted.org/packages/16/24/0af1fe37f6c50a9deabc72ac08d549e56cd1632617de453021812b92691b/python_cpdlc-1.3.8.tar.gz",
"platform": null,
"description": "# python-cpdlc\nA simple CPDLC client for flight simulation written by python\n\n## Quick Start\n1. install package with pip or any tools you like\n```shell\npip install python-cpdlc\n```\n2. use example code under \nBy the way, dont forgot to logon your ATC CPDLC first :)\n```python\nimport asyncio\n\nfrom python_cpdlc import CPDLC\n\n\nasync def main():\n # Create CPDLC client instance\n cpdlc = CPDLC()\n\n # Set your hoppie code\n cpdlc.set_logon_code(\"11111111111\")\n\n # Set your email for network change (If you dont need to change network, you can skip it)\n cpdlc.set_email(\"halfnothingno@gmail.com\")\n\n # of course, you can use your own hoppie server\n # cpdlc.set_acars_url(\"http://127.0.0.1:80\")\n\n # you can add callback function which will be called when cpdlc connected and disconnected\n # there can only be one callback function per event\n # cpdlc.set_cpdlc_connect_callback(lambda: None)\n # cpdlc.set_cpdlc_disconnect_callback(lambda: None)\n # cpdlc.set_cpdlc_atc_info_update_callback(lambda: None)\n\n # you also can add message callback\n # cpdlc.add_message_sender_callback()\n # cpdlc.add_message_receiver_callback()\n\n # Decorators are recommended unless your callback function is a class method\n # @cpdlc.listen_message_receiver()\n # def message_receiver(msg: AcarsMessage):\n # pass\n # @cpdlc.listen_message_sender()\n # def message_sender(to: str, msg: str):\n # pass\n\n # you should set your callsign before you use CPDLC, and you can change this anytime you like\n # but if you change this callsign, you may miss some message send to you\n cpdlc.set_callsign(\"CES2352\")\n\n # after set complete, you need to initialize service\n cpdlc.initialize_service()\n\n # you can reset service or reinitialize service anytime you like\n # cpdlc.reset_service()\n # cpdlc.reinitialize_service()\n\n # you can get your current network by cpdlc.network\n # you can change your network if necessary\n # cpdlc.change_network(Network.VATSIM)\n\n # some function...\n # cpdlc.query_info()\n # cpdlc.send_telex_message()\n # cpdlc.departure_clearance_delivery()\n\n # send login request\n cpdlc.cpdlc_login(\"ZSHA\")\n\n # wait 60 seconds\n await asyncio.sleep(60)\n\n # request logout\n cpdlc.cpdlc_logout()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "A simple CPDLC client",
"version": "1.3.8",
"project_urls": null,
"split_keywords": [
"cpdlc",
" python",
" httpx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "daf31b91e8c64f8f30cdbe4272e6367aed87371484d3ce676f09017209c16d9a",
"md5": "81273ae9093f2924a12c7c72f4c0ebe9",
"sha256": "6c1f3e5e81e91cee7827c15dd7e67a2cc5e4a4583256e079e32f05fb19a918ba"
},
"downloads": -1,
"filename": "python_cpdlc-1.3.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81273ae9093f2924a12c7c72f4c0ebe9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 35267,
"upload_time": "2025-07-28T19:40:55",
"upload_time_iso_8601": "2025-07-28T19:40:55.422269Z",
"url": "https://files.pythonhosted.org/packages/da/f3/1b91e8c64f8f30cdbe4272e6367aed87371484d3ce676f09017209c16d9a/python_cpdlc-1.3.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "16240af1fe37f6c50a9deabc72ac08d549e56cd1632617de453021812b92691b",
"md5": "1dda6ca5efd6052ecf3ce0910d7e91f8",
"sha256": "c09c37618c5ab872b49c3d5c40abff79a2f56cc630912f766da5b5f284959ec3"
},
"downloads": -1,
"filename": "python_cpdlc-1.3.8.tar.gz",
"has_sig": false,
"md5_digest": "1dda6ca5efd6052ecf3ce0910d7e91f8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 29263,
"upload_time": "2025-07-28T19:40:56",
"upload_time_iso_8601": "2025-07-28T19:40:56.875319Z",
"url": "https://files.pythonhosted.org/packages/16/24/0af1fe37f6c50a9deabc72ac08d549e56cd1632617de453021812b92691b/python_cpdlc-1.3.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 19:40:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "python-cpdlc"
}