|
| 1 | +Xolphin API wrapper for Python |
| 2 | +============================== |
| 3 | + |
| 4 | +Library installation |
| 5 | +-------------------- |
| 6 | + |
| 7 | +Library can be installed via `pip <https://pypi.python.org/pypi/pip>`__ |
| 8 | + |
| 9 | +:: |
| 10 | + |
| 11 | + pip install xolphin-api |
| 12 | + |
| 13 | +And updated via |
| 14 | + |
| 15 | +:: |
| 16 | + |
| 17 | + pip install xolphin-api --upgrade |
| 18 | + |
| 19 | +Or manually from source |
| 20 | + |
| 21 | +:: |
| 22 | + |
| 23 | + git clone https://github.com/xolphin/xolphin-api-python.git |
| 24 | + cd xolphin-api-python |
| 25 | + python setup.py install |
| 26 | + |
| 27 | +Usage |
| 28 | +----- |
| 29 | + |
| 30 | +Client initialization |
| 31 | +~~~~~~~~~~~~~~~~~~~~~ |
| 32 | + |
| 33 | +.. code:: python |
| 34 | +
|
| 35 | + import xolphin |
| 36 | +
|
| 37 | + client = xolphin.Client('<username>', '<password>') |
| 38 | +
|
| 39 | +Requests |
| 40 | +~~~~~~~~ |
| 41 | + |
| 42 | +Getting list of requests |
| 43 | +^^^^^^^^^^^^^^^^^^^^^^^^ |
| 44 | + |
| 45 | +.. code:: python |
| 46 | +
|
| 47 | + requests = client.request().all() |
| 48 | + for request in requests: |
| 49 | + print request.id, request.product.id |
| 50 | +
|
| 51 | +Getting request by ID |
| 52 | +~~~~~~~~~~~~~~~~~~~~~ |
| 53 | + |
| 54 | +.. code:: python |
| 55 | +
|
| 56 | + request = client.request().get(961992637) |
| 57 | + print(request.product.brand) |
| 58 | +
|
| 59 | +Request certificate |
| 60 | +~~~~~~~~~~~~~~~~~~~ |
| 61 | + |
| 62 | +.. code:: python |
| 63 | +
|
| 64 | + ccr = client.request().create(24, 1, 'csr string', 'EMAIL') |
| 65 | + ccr.address = 'Address' |
| 66 | + ccr.approver_first_name = 'FirstName' |
| 67 | + ccr.approver_last_name = 'LastName' |
| 68 | + ccr.approver_phone = '+12345678901' |
| 69 | + ccr.approver_email = 'email@domain.com' |
| 70 | + ccr.zipcode = '123456' |
| 71 | + ccr.city = 'City' |
| 72 | + ccr.company = 'Company' |
| 73 | + ccr.subject_alternative_names.append('test1.domain.com') |
| 74 | + ccr.subject_alternative_names.append('test2.domain.com') |
| 75 | + ccr.dcv.append({ |
| 76 | + 'domain': 'test1.domain.com', |
| 77 | + 'dcvType': 'EMAIL', |
| 78 | + 'approverEmail': 'email@domain.com' |
| 79 | + }) |
| 80 | +
|
| 81 | + request = client.request().send(ccr) |
| 82 | + print(request.id) |
| 83 | +
|
| 84 | +Certificate |
| 85 | +~~~~~~~~~~~ |
| 86 | + |
| 87 | +Certificates list and expirations |
| 88 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 89 | + |
| 90 | +.. code:: python |
| 91 | +
|
| 92 | + certificates = client.certificate().all() |
| 93 | + for certificate in certificates: |
| 94 | + print(certificate.id, certificate.isExpired()) |
| 95 | +
|
| 96 | +Download certificate |
| 97 | +^^^^^^^^^^^^^^^^^^^^ |
| 98 | + |
| 99 | +.. code:: python |
| 100 | +
|
| 101 | + cert = client.certificate().download(961983489, 'CRT') |
| 102 | + with open('crt.crt', 'wb') as f: |
| 103 | + f.write(cert) |
| 104 | +
|
| 105 | +Support |
| 106 | +~~~~~~~ |
| 107 | + |
| 108 | +Products list |
| 109 | +^^^^^^^^^^^^^ |
| 110 | + |
| 111 | +.. code:: python |
| 112 | +
|
| 113 | + products = client.support().products() |
| 114 | + for product in products: |
| 115 | + print(product.id, product.brand) |
| 116 | +
|
| 117 | +Decode CSR |
| 118 | +^^^^^^^^^^ |
| 119 | + |
| 120 | +.. code:: js |
| 121 | +
|
| 122 | + data = client.support().decode_csr('csr string') |
| 123 | + print(data.type, data.size) |
0 commit comments