Skip to main content

Python client for AEM API

Project description

Build Status Published Version Vulnerability Scanning Status

PythonAEM

PythonAEM is a Python client for Adobe Experience Manager (AEM) API. It is written on top of swaggeraem and provides resource-oriented API and convenient response handling.

Learn more about PythonAEM:

pythonaem is part of AEM OpenCloud platform but it can be used as a stand-alone.

Installation

pip3 install pythonaem

Usage

Initialise client:

from pythonaem import PythonAem

conf = {
    'username': 'admin',
    'password': 'admin',
    'protocol': 'http',
    'host': 'localhost',
    'port': 4502,
    'debug': True,
    'verify_ssl': True,
    'ssl_ca_cert': None,
    'cert_file': None,
    'key_file': None
}
client = PythonAem(conf)

Aem:

aem = client.aem()
result = aem.get_aem_health_check({
    'tags': 'shallow',
    'combine_tags_or': 'false',
})

Flush agent:

flush_agent = client.flush_agent('author', 'some-flush-agent')

# create or update flush agent
result = flush_agent.create_update('Some Flush Agent Title', 'Some flush agent description', 'http://somehost:8080')

# check flush agent's existence
result = flush_agent.exists()

# Disable flush agent
result = flush_agent.disable()

# Enable flush agent
result = flush_agent.enable()

# delete flush agent
result = flush_agent.delete()

Replication agent:

replication_agent = client.replication_agent('author', 'some-replication-agent')

# create or update replication agent
result = replication_agent.create_update('Some Replication Agent Title', 'Some Replication agent description', 'http://somehost:8080')

# check replication agent's existence
result = replication_agent.exists()

# Disable replication agent
result = replication_agent.disable()

# Enable replication agent
result = replication_agent.enable()

# delete replication agent
result = replication_agent.delete()

Result

Each of the above method calls returns a Result, which contains message, Response, and data payload. For example:

flush_agent = client.flush_agent('author', 'some-inexisting-flush-agent')
result = flush_agent.delete()
print(result.message)
print(result.response.status_code)
print(result.response.body)
print(result.response.headers)
print(result.data)

Error Handling

flush_agent = client.flush_agent('author', 'some-inexisting-flush-agent')
try:
    result = flush_agent.delete()
except Exception as error:
    self.assertEqual(error.message, 'Flush agent some-inexisting-flush-agent not found on author')

Testing

Integration tests require an AEM instance with Shine Solutions AEM Health Check package installed.

By default it uses AEM running on http://localhost:4502 with admin username and admin password. AEM instance parameters can be configured using environment variables aem_protocol, aem_host, aem_port, aem_username, and aem_password.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonaem-1.7.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

pythonaem-1.7.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file pythonaem-1.7.1.tar.gz.

File metadata

  • Download URL: pythonaem-1.7.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.4

File hashes

Hashes for pythonaem-1.7.1.tar.gz
Algorithm Hash digest
SHA256 ed06efb5f4396a1a9e538a8181b86ed270776374212d92f7ab52ed20b4950e6e
MD5 5d0c4afda7b0fe41792451246274cdc5
BLAKE2b-256 5a556fd16905aa604118a8746a76ba282b476033e19522b7d6a16a9fc0532326

See more details on using hashes here.

File details

Details for the file pythonaem-1.7.1-py3-none-any.whl.

File metadata

  • Download URL: pythonaem-1.7.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.4

File hashes

Hashes for pythonaem-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 574dd62d166ea92ab4a23d91c1299910f2948456ffd8740c12909d5e0b2ea21b
MD5 f577fdca5f26f64b4da0cea7a068c42f
BLAKE2b-256 b3184d94bfa979dea99e35be9b692fc640bd3c3f83146140e6394d2c22c89f3f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page