Skip to content

Commit dd176f2

Browse files
committed
Adding click to handle arguments + small changes
1 parent 8b4b50e commit dd176f2

File tree

3 files changed

+217
-192
lines changed

3 files changed

+217
-192
lines changed

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Rationale
55
Recently I wanted to purchase a Kimsufi server. However, I was not
66
the only one to want one and OVH has no queuing mechanim, leaving
7-
me the only option of reloading the availability page waiting for an
7+
me the only option of reloading the availability page waiting for an
88
opportunity to rent one.
99

1010
Pretty quickly, I came up with this script: an **automated tool** to
@@ -14,21 +14,45 @@ wasting your precious time waiting!
1414
# Usage
1515

1616
- Install requirements: `pip install -r requirements.txt`
17+
- One of the dependency is `Selenium` that depends on drivers: https://github.com/SeleniumHQ/selenium/blob/master/py/docs/source/index.rst#user-content-drivers.
18+
On Mac for example run:
19+
```
20+
brew install geckodriver
21+
```
1722
- Connect your OVH account to PayPal (this seemed the best option to avoid handling Credit Card data, but PR welcome if you want to do otherwise!)
18-
- Set the environment variables `OVH_USERNAME` and `OVH_PASSWORD` (they are used to automate the purchase itself)
19-
- Set `ref_product` to the product you want (default: `150sk22`) and `ref_zone` to the zone you want to rent it in (default: `bhs`, Beauharnois datacenter)
2023
- Run `python buyKim.py`
21-
- ???
24+
```
25+
$ python buyKim.py --help
26+
Usage: buyKim.py [OPTIONS]
27+
28+
Options:
29+
-t, --timeout-conn INTEGER Maximum time in seconds to wait for webservice
30+
answer. [default: 5]
31+
-i, --interval FLOAT Minimum interval in seconds between two requests
32+
[default: 7.5]
33+
-f, --product-family TEXT The family of servers (ie. "Kimsufi"/"So you
34+
Start") [default: Kimsufi]
35+
-p, --ref-product TEXT Reference of the server (ie 1801sk12 for KS1,
36+
1801sys29 for some soYouStart servers [default:
37+
1801sk12]
38+
-z, --ref-zones TEXT Data center short name(s) (ie "-z gra -z rbx
39+
[default: gra, rbx, lon, fra]
40+
--ovh-user TEXT
41+
--ovh-pass TEXT
42+
--debug / --no-debug Debug mode, disable by default. Add --debug flag
43+
to enable
44+
--help Show this message and exit.
45+
```
2246
- Profit!
2347

2448
# Architecture
2549

2650
The script is split in two parts:
2751

28-
- The first part uses `requests` to poll OVH's availability webservice,
29-
and parses its response to find the product you want. When the response
52+
- The first part uses `requests` to poll OVH's availability webservice,
53+
and parses its response to find the product you want. When the response
3054
describes your product as available, the second part of the script kicks in.
31-
- The second part uses `selenium` for opening the listing page, then selects
55+
- The second part uses `selenium` for opening the listing page, then selects
3256
your product, injects some Angular.JS-specific JavaScript for selecting your
3357
datacenter, waits for PayPal to load, and clicks on Purchase!
3458

0 commit comments

Comments
 (0)