@@ -40,7 +40,7 @@ credential creation and requests signing.
4040 )
4141
4242 # Print nice welcome message
43- print " Welcome" , client.get(' /me' )[' firstname' ]
43+ print ( " Welcome" , client.get(' /me' )[' firstname' ])
4444
4545 Installation
4646============
@@ -133,6 +133,11 @@ customer's information:
133133
134134 # -*- encoding: utf-8 -*-
135135
136+ try :
137+ input = raw_input
138+ except NameError :
139+ pass
140+
136141 import ovh
137142
138143 # create a client using configuration
@@ -145,12 +150,12 @@ customer's information:
145150 # Request token
146151 validation = ck.request()
147152
148- print " Please visit %s to authenticate" % validation[' validationUrl' ]
149- raw_input (" and press Enter to continue..." )
153+ print ( " Please visit %s to authenticate" % validation[' validationUrl' ])
154+ input (" and press Enter to continue..." )
150155
151156 # Print nice welcome message
152- print " Welcome" , client.get(' /me' )[' firstname' ]
153- print " Btw, your 'consumerKey' is '%s '" % validation[' consumerKey' ]
157+ print ( " Welcome" , client.get(' /me' )[' firstname' ])
158+ print ( " Btw, your 'consumerKey' is '%s '" % validation[' consumerKey' ])
154159
155160
156161 Returned ``consumerKey `` should then be kept to avoid re-authenticating your
@@ -195,7 +200,7 @@ is only supported with reserved keywords.
195200 to = DESTINATION ,
196201 localCopy = False
197202 )
198- print " Installed new mail redirection from %s to %s " % (SOURCE , DESTINATION )
203+ print ( " Installed new mail redirection from %s to %s " % (SOURCE , DESTINATION ) )
199204
200205 Grab bill list
201206--------------
@@ -220,12 +225,12 @@ This example assumes an existing Configuration_ with valid ``application_key``,
220225 bills = client.get(' /me/bill' )
221226 for bill in bills:
222227 details = client.get(' /me/bill/%s ' % bill)
223- print " %12s (%s ): %10s --> %s " % (
228+ print ( " %12s (%s ): %10s --> %s " % (
224229 bill,
225230 details[' date' ],
226231 details[' priceWithTax' ][' text' ],
227232 details[' pdfUrl' ],
228- )
233+ ))
229234
230235 Enable network burst in SBG1
231236----------------------------
@@ -255,7 +260,7 @@ This example assumes an existing Configuration_ with valid ``application_key``,
255260 if details[' datacenter' ] == ' sbg1' :
256261 # enable burst on server
257262 client.put(' /dedicated/server/%s /burst' % server, status = ' active' )
258- print " Enabled burst for %s server located in SBG-1" % server
263+ print ( " Enabled burst for %s server located in SBG-1" % server)
259264
260265 List application authorized to access your account
261266--------------------------------------------------
@@ -295,8 +300,8 @@ This example assumes an existing Configuration_ with valid ``application_key``,
295300 credential[' expiration' ],
296301 credential[' lastUse' ],
297302 ])
298- print tabulate(table, headers = [' ID' , ' App Name' , ' Description' ,
299- ' Token Creation' , ' Token Expiration' , ' Token Last Use' ])
303+ print ( tabulate(table, headers = [' ID' , ' App Name' , ' Description' ,
304+ ' Token Creation' , ' Token Expiration' , ' Token Last Use' ]))
300305
301306 Before running this example, make sure you have the
302307`tabulate <https://pypi.python.org/pypi/tabulate >`_ library installed. It's a
@@ -326,7 +331,7 @@ fully installed on the machine and a consumer key allowed on the server exists.
326331
327332 # check arguments
328333 if len (sys.argv) != 3 :
329- print " Usage: %s SERVER_NAME ALLOWED_IP_V4" % sys.argv[0 ]
334+ print ( " Usage: %s SERVER_NAME ALLOWED_IP_V4" % sys.argv[0 ])
330335 sys.exit(1 )
331336
332337 server_name = sys.argv[1 ]
@@ -343,7 +348,7 @@ fully installed on the machine and a consumer key allowed on the server exists.
343348 try :
344349 # use a named temfile and feed it to java web start
345350 with tempfile.NamedTemporaryFile() as f:
346- f.write(client.get(' /dedicated/server/ns6457228.ip-178-33-61.eu /features/ipmi/access?type=kvmipJnlp' )[' value' ])
351+ f.write(client.get(' /dedicated/server/' + server_name + ' /features/ipmi/access?type=kvmipJnlp' )[' value' ])
347352 f.flush()
348353 subprocess.call([" javaws" , f.name])
349354 break
@@ -355,10 +360,10 @@ Running is only a simple command line:
355360.. code :: bash
356361
357362 # Basic
358- python open_kvm.py ns1234567.ip-178 -42-42.eu $( curl ifconfig.ovh)
363+ python open_kvm.py ns1234567.ip-42 -42-42.eu $( curl ifconfig.ovh)
359364
360365 # Use a specific consumer key
361- OVH_CONSUMER_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA python open_kvm.py ns6457228 .ip-178-33-61 .eu $( curl -s ifconfig.ovh)
366+ OVH_CONSUMER_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA python open_kvm.py ns1234567 .ip-42-42-42 .eu $( curl -s ifconfig.ovh)
362367
363368 Configuration
364369=============
0 commit comments