]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/buy_vps_server.py
2803e32b3bd7c835c043350e2123142e9c7a6bbe
1 # -*- encoding: utf-8 -*-
6 # In case it's installed globally
11 # Credentials are stored in ~/.ovh.conf
16 cart
= client
.post('/order/cart', ovhSubsidiary
="FR")
17 cart_id
= cart
["cartId"]
19 # Assign it to my user
20 client
.post('/order/cart/{}/assign'.format(cart_id
))
23 # client.get('/order/cart/{}/vps'.format(cart_id))
24 item
= client
.post('/order/cart/{}/vps'.format(cart_id
),
26 planCode
="vps_ssd_model1",
27 pricingMode
="default",
29 item_id
= item
["itemId"]
31 # Datacenter, OS, auto-renew
32 client
.post('/order/cart/{}/item/{}/configuration'.format(cart_id
, item_id
),
33 label
="vps_ssd_datacenter",
35 client
.post('/order/cart/{}/item/{}/configuration'.format(cart_id
, item_id
),
37 value
="linux--archlinux--64--en")
38 client
.post('/order/cart/{}/item/{}/configuration'.format(cart_id
, item_id
),
39 label
="AUTO_RENEW_VPS",
42 #summary = client.get('/order/cart/{}/summary'.format(cart_id))
43 #checkout = client.get('/order/cart/{}/checkout'.format(cart_id))
46 order
= client
.post('/order/cart/{}/checkout'.format(cart_id
),
47 waiveRetractationPeriod
=True)
48 order_id
= order
["orderId"]
52 # /me/order/{orderId}/availableRegisteredPaymentMean
53 # /me/paymentMean ? /me/order/{orderId}/debt/pay ?