Infinite Flight Connect Python
This is a technical post. Feel free to skip to the bottom to learn how to use it!
While working on a different project, I needed a way to connect to the Infinite Flight Connect API. Therefore, I spent an afternoon creating a python module to make it easier to interface with the IF Connect API. The Connect API allows a program to communicate with Infinite Flight through a TCP connection. You can read all about the API here: Connect API v1 | Infinite Flight.
My python module makes it much easier for any developer interface with the API. It is also open source on GitHub so feel free to tinker and play with it all you want :)
Getting set up
- Enable IF Connect in the Infinite Flight settings (also make sure your computer and simulator are running on the same local network)
- Install the python module using pip
pip3 install IFConnectOld(make sure it’s version >=1.0.2 since 1.0.0 and 1.0.1 doesn’t work)
- In your own python script, import the module
from IFConnectOld import *
- To send a command, use the send_command function
send_commandfunction with the command, parameters and whether or not you want to await response. This function prints out the status and then returns the response if
from IFConnectOld import * send_command("Airplane.GetState", , await_response=True) # This command will yield a response. send_command("Commands.LandingLights", ) # await response if false by default. this command does not return a response and awaiting a response will simply lead to the program hanging.
The source code for this project be found at the following GitHub link.