=== Python SDK Reference ==== Getting Started Inside the `clients/python` directory of the installation is an SDK for using Helix Web Services from Python. Typically, you'll create instances of `ApiClient` and `DefaultApi`, log in, then update configuration with your Perforce ticket. [source,python] .... from helix_web_services_client import ApiClient, DefaultApi, configuration from helix_web_services_client.models import LoginRequest # Your system will likely start by accessing a self-signed certificate. # Do not use this in production. configuration.verify_ssl = False # The URL version is typically specified by python clients as part of the host address api_client = ApiClient('https://myhws.example.com/api/2016.1.0') default_api = DefaultApi(api_client) # Log in and grab a ticket login_request = LoginRequest() login_request.user = 'myuser' login_request.password = 'mypassword' login_response = self.default_api.login_post(login_request) # Use the ticket with HTTP Basic authentication configuration.api_key['Authorization'] = login_response.ticket # OK, now you can use the default_api with commands depots = default_api.server_depots_get('myserver') .... We do not publish a module, so you'll have to go the "personal PyPI" route. The following instructions work on Unices. For more information see http://docs.python-guide.org/en/latest/shipping/packaging/#personal-pypi[the online Python guide]. Create a helix_web_services_client.tar.gz: .... cd INSTALL_DIR/clients/python/helix_web_services_client tar czf helix_web_services_client.tar.gz * .... Then, go up a directory and start the PyPI server in the `clients/python` directory: .... cd INSTALL_DIR/clients/python python -m SimpleHTTPServer 9000 .... Then, install the module into your python distribution: .... pip install --extra-index-url=http://127.0.0.1:9000/ helix_web_services_client .... ==== ApiClient reference The `ApiClient` can be created, though is not required, before creating the API interfaces like `DefaultApi` or `AlphaApi`. ===== Constructor Creates the `ApiClient` instance, that contains logic used by each of the API interfaces. Will be created by default by those API objects, and is typically accessible via the `api.api_client` property. .Method Signature [source,python] .... ApiClient helix_web_services_client.ApiClient(host=None, header_name=None, header_value=None) .... .Parameters [cols="1,1,2a,1", options="header"] |=== | Name | Type | Description | Required | host | str | The base path for the server to call. | No | header_name | str | A header to pass when making calls to the API. | No | header_value | str | A header value to pass when making calls to the API. | No |=== ===== Properties [cols="1,1,2a,1", options="header"] |=== | Name | Type | Description | host | str | The base path for the server to call. | user_agent | str | The `User-Agent` string header value. |=== ===== ApiClient.set_default_header Adds a default header value to requests. .Method Signature [source,python] .... helix_web_services_client.ApiClient.set_default_header(header_name, header_value) .... .Parameters [cols="1,1,2a,1", options="header"] |=== | Name | Type | Description | Required | header_name | str | A header to pass when making calls to the API. | Yes | header_value | str | A header value to pass when making calls to the API. | Yes |=== ==== Configuration reference Typically accessed via the global value `configuration`, sets various settings for the client interaction. [source,python] .... from helix_web_services_client import configuration configuration.api_key['Authorization'] = '1245xwadf...' .... ===== Properties [cols="1,1,2a,1", options="header"] |=== | Name | Type | Description | api_key | dict | Stores the API key for authorization, typically at the 'Authorization' header. For example, `configuration.api_key['Authorization'] = login_response.ticket` | cert_file | str | The client certificate file, defaults to None. | debug | bool | Enable debug logging, defaults to False | key_file | str | The client key file, defaults to None. | ssl_ca_cert | str | Customize the certificate authority file to verify the peer, defaults to None. | verify_ssl | bool | Enable SSL certificate verification, defaults to True. |=== ==== DefaultApi reference include::../python-default.adoc[] ==== AlphaApi reference include::../python-alpha.adoc[] ==== Models include::../python-models.adoc[]
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 19328 | tjuricek |
Add documentation for default swagger-generated classes and objects (not specified by our definition). Oh, and don't log people's passwords. |
||
#2 | 19313 | tjuricek | Revise the generated asciidoc for the python reference, and include python model definitions. | ||
#1 | 19012 | tjuricek | Revised Java client SDK, added ApiClient reference, restructured documentation. |