# 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
# @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, requests",
"author": null,
"author_email": "Half_nothing <Half_nothing@163.com>",
"download_url": "https://files.pythonhosted.org/packages/60/e3/8a109230ef436a7261b6e6d3edd0de448931033609ccab86675e68ba0397/python_cpdlc-1.3.0.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\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.0",
"project_urls": null,
"split_keywords": [
"cpdlc",
" python",
" requests"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fd2af113e46517191f818455bc94fd3ecdd338a7057946550aecf48eccf47f4b",
"md5": "5aca960a6db2f26901c1cd1ef94def4b",
"sha256": "294606ebf2e7ca3d058e29f82f7dcbb4e8af6af5d7472cc172f2ac925398fc6e"
},
"downloads": -1,
"filename": "python_cpdlc-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5aca960a6db2f26901c1cd1ef94def4b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 22386,
"upload_time": "2025-07-16T13:29:12",
"upload_time_iso_8601": "2025-07-16T13:29:12.707399Z",
"url": "https://files.pythonhosted.org/packages/fd/2a/f113e46517191f818455bc94fd3ecdd338a7057946550aecf48eccf47f4b/python_cpdlc-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "60e38a109230ef436a7261b6e6d3edd0de448931033609ccab86675e68ba0397",
"md5": "579db2faaf4ec3e85af64468a399e89c",
"sha256": "7d13d545741be2b9df6b8a4ed088a9f099beabcbadbd440d405fba9ffebd2a6c"
},
"downloads": -1,
"filename": "python_cpdlc-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "579db2faaf4ec3e85af64468a399e89c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 21553,
"upload_time": "2025-07-16T13:29:14",
"upload_time_iso_8601": "2025-07-16T13:29:14.422949Z",
"url": "https://files.pythonhosted.org/packages/60/e3/8a109230ef436a7261b6e6d3edd0de448931033609ccab86675e68ba0397/python_cpdlc-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 13:29:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "python-cpdlc"
}