Skip to main content

python-cephclient is a python module to communicate with Ceph’s REST API (ceph-rest-api).

This is currently a work in progress.

ABOUT

Client

The cephclient class takes care of sending calls to the API through HTTP and handle the responses. It supports queries for JSON, XML, plain text or binary.

Wrapper

The wrapper class extends the client and provides helper functions to communicate with the API.

Nothing prevents you from calling the client directly exactly like the wrapper does. The wrapper exists for convenience.

Development, Feedback, Bugs

Want to contribute ? Feel free to send pull requests !

Have problems, bugs, feature ideas ? I am using the github issue tracker to manage them.

HOW TO USE

Installation

Install the package through pip:

pip install python-cephclient

Installation does not work ?

python-cephclient depends on lxml which itself depends on some packages. To install lxml’s dependencies on Ubuntu:

apt-get install python-dev libxml2-dev libxslt-dev

Instanciate CephWrapper:

from cephclient.wrapper import *

wrapper = CephWrapper(
    endpoint = 'http://apiserver:5000/api/v0.1/',
    debug = True # Optionally increases the verbosity of the client
)

Do your request and specify the reponse type you are expecting.

Either json, xml, text (default) or binary are available.

json:

response, body = wrapper.get_fsid(body = 'json')
print('Response: {0}, Body:\n{1}'.format(response, json.dumps(body, indent=4, separators=(',', ': '))))

====

Response: <Response [200]>, Body:
{
    "status": "OK",
    "output": {
        "fsid": "d5252e7d-75bc-4083-85ed-fe51fa83f62b"
    }
}

xml:

response, body = wrapper.get_fsid(body = 'xml')
print('Response: {0}, Body:\n{1}'.format(reponse, etree.tostring(body, pretty_print=True)))

====

Response: <Response [200]>, Body:
<response>
  <output>
    <fsid><fsid>d5252e7d-75bc-4083-85ed-fe51fa83f62b</fsid></fsid>
  </output>
  <status>
    OK
  </status>
</response>

text:

response, body = wrapper.get_fsid(body = 'text')
print('Response: {0}, Body:\n{1}'.format(response, body))

====

Response: <Response [200]>, Body:
d5252e7d-75bc-4083-85ed-fe51fa83f62b

binary:

response, body = wrapper.mon_getmap(body = 'binary')
# < Do something binary with 'body' >

RELEASE NOTES

0.1.0.5

dmsimard:

  • Add missing dependency on the requests library

  • Some PEP8 and code standardization cleanup

  • Add root “PUT” methods

  • Add mon “PUT” methods

  • Add mds “PUT” methods

  • Add auth “PUT” methods

Donald Talton:

  • Add osd “PUT” methods

0.1.0.4

  • Fix setup and PyPi installation

0.1.0.3

  • GET API calls under ‘/tell’ have been implemented.

  • GET API calls are are in root (/) have been renamed to be coherent with incoming future development

0.1.0.2

  • Implemented or fixed missing GET calls (All API GET calls that are not under the ‘/tell’ namespace are now supported)

  • Client can optionally raise an exception when requesting a unsupported body type for a provided API call (ex: requesting json through the wrapper for a call that is known to only return binary will raise an exception)

  • Client now supports binary type responses (ex: crush map, mon map, etc)

  • Improved the README (!)

0.1.0.1

  • First public release of python-cephclient

Metadata

Release files for python-cephclient 0.1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-cephclient 0.1.0.5
File Size Uploaded
python-cephclient-v0.1.0.5.tar.gz 10.6 kB Details

Release files / python-cephclient-v0.1.0.5.tar.gz

Download URL python-cephclient-v0.1.0.5.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9776b786da2aebdc0439ea2f809cc8923f52bc0cf610f77a9c1348466961134b
BLAKE2b-256 checksum
How to use checksums
b24fe8d46c0c836d2d1ed5d194f72a966b6563aab10cfa332c43f24f55224953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0.5 This release

1 release file

0.1.0.3

1 release file

0.1.0.2

1 release file

0.1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page