1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616#
17-
18- from __future__ import print_function
19- from vcert import (CertificateRequest , Connection , CloudConnection ,
20- FakeConnection , TPPConnection , RevocationRequest , KeyType )
17+ from vcert import (CertificateRequest , Connection , CloudConnection , FakeConnection , TPPConnection , RevocationRequest ,
18+ KeyType )
2119import string
2220import random
2321import logging
@@ -48,7 +46,7 @@ def main():
4846 http_request_kwargs = {"verify" : False })
4947 # If your TPP server certificate signed with your own CA, or available only via proxy, you can specify
5048 # a trust bundle using requests vars:
51- #conn = Connection(url=url, token=token, user=user, password=password,
49+ # conn = Connection(url=url, token=token, user=user, password=password,
5250 # http_request_kwargs={"verify": "/path-to/bundle.pem"})
5351
5452 request = CertificateRequest (common_name = randomword (10 ) + ".venafi.example.com" )
@@ -62,11 +60,11 @@ def main():
6260 # Specify ordering certificates in chain. Root can be "first" or "last". By default it last. You also can
6361 # specify "ignore" to ignore chain (supported only for Platform).
6462 # To set Custom Fields for the certificate, specify an array of CustomField objects as name-value pairs
65- #request.custom_fields = [
63+ # request.custom_fields = [
6664 # CustomField(name="Cost Center", value="ABC123"),
6765 # CustomField(name="Environment", value="Production"),
6866 # CustomField(name="Environment", value="Staging")
69- #]
67+ # ]
7068
7169 # configure key type, RSA example
7270 request .key_type = KeyType (KeyType .RSA , 2048 )
@@ -96,7 +94,7 @@ def main():
9694 f .close ()
9795
9896 if not isinstance (conn , FakeConnection ):
99- # fake connection doesn` t support certificate renewing
97+ # fake connection doesn' t support certificate renewing
10098 print ("Trying to renew certificate" )
10199 new_request = CertificateRequest (
102100 cert_id = request .id ,
@@ -141,6 +139,7 @@ def main():
141139 f .write (cert .full_chain )
142140 f .close ()
143141
142+
144143def randomword (length ):
145144 letters = string .ascii_lowercase
146145 return '' .join (random .choice (letters ) for i in range (length ))
0 commit comments