Python - documentation, supported libraries, etc

Not applicable

I was just wondering if someone could point me to any documentation for Python scripts within Apigee. I searched around a bit but couldn't find much detail. I already found the two primary documents on Python Script Policies and Python Script.

I am looking for things such as supported libraries, which version of python, and the conversion points/functionality for accessing Apigee resoureces. For example, it seems that flow is the Python equivalent of the JavaScript context.

I am curious to try out some Python scripting.

1 5 915
5 REPLIES 5

Do you mean that you are a private cloud customer and want to look at the scripts provided by Apigee? The scripts are described in the "ApigeeEdgePrivateCloud Tools.xlsx" file that is included with the private cloud documentation, and in the Installation Guide and Operations Guide.

In terms of the version of Python, it is the version installed with UNIX tools as provided by EL5 or EL6, for example Pyhton 2.6.6.

Stephen

I am not certain what you mean by "private cloud customer". I am an enterprise customer, but we don't use the "on-prem" solution. Python policies and script can be added from the UI, so I assumed I had the ability to use them. May this not be the case?

@jasons I interpret from your above comment that you are in the Apigee Public Cloud, where we are broadly compatible with Python 2.5 but system calls, for example network I/O, filesystem read/writes, current user info, process list, and CPU/memory utilization are not permitted by the security model. Although some such calls may be functional, they are unsupported and liable to be actively disabled at any time.

Also, while I believe you are already aware of these docs, for completeness, general info on the python script policy is available via this documentation link.

You can see some python samples here, search for "python" and then take a look at the relevant sample API Proxy via its link to github. Navigate to the apiproxy/resources/py folder within each of the sample proxies.

Not applicable

It really is not clear what libraries are supported.

I am getting an error when I import json library into a python file.

Not applicable

Even I am running into issue importing json library. Is this supported?