The API will work with 22.7 of course, but yes, on that older server, the key you generate will have the prefix. Basically, if your netrc has the key as it was generated (and it hasn't expired) it should authenticate. I've also updated the documentation to clarify this and that when you're passing the authentication details in netrc, you should not include the api_key parameter in the API wrapper.
Assuming that's what you're doing, and it's good news that you can successfully connect to your local, another common issue with API wrapper calls is the context_path parameter - does the URL for the 22.7 server and container you want look like this?
http://mylabkeyserver.ca/labkey/Test_Lab
A common configuration for 'non-local/dev' instances is to use a ROOT.xml file instead of a labkey.xml file, meaning that instead the URL would be missing the "labkey/" and you would want to have your script use context_path='' (an empty string).
http://mylabkeyserver.ca/Test_Lab
I think it will work best to move this to your Support Portal, where we can better exchange more specific details of your script and configuration.
Thanks,
--Molly