Skip to content

Commit edc921e

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

File tree

3 files changed

+222
-192
lines changed

3 files changed

+222
-192
lines changed

README.md

Lines changed: 36 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,50 @@ wasting your precious time waiting!
1414
# Usage
1515

1616
- Install requirements: `pip install -r requirements.txt`
17+
18+
- 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.
19+
20+
On Mac to make this step easier, run:
21+
```
22+
brew install geckodriver
23+
```
24+
1725
- 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)
26+
2027
- Run `python buyKim.py`
21-
- ???
28+
```
29+
$ python buyKim.py --help
30+
Usage: buyKim.py [OPTIONS]
31+
32+
Options:
33+
-t, --timeout-conn INTEGER Maximum time in seconds to wait for webservice
34+
answer. [default: 5]
35+
-i, --interval FLOAT Minimum interval in seconds between two requests
36+
[default: 7.5]
37+
-f, --product-family TEXT The family of servers (ie. "Kimsufi"/"So you
38+
Start") [default: Kimsufi]
39+
-p, --ref-product TEXT Reference of the server (ie 1801sk12 for KS1,
40+
1801sys29 for some soYouStart servers [default:
41+
1801sk12]
42+
-z, --ref-zones TEXT Data center short name(s) (ie "-z gra -z rbx")
43+
[default: gra, rbx, lon, fra]
44+
--ovh-user TEXT
45+
--ovh-pass TEXT
46+
--debug / --no-debug Debug mode, disable by default. Add --debug flag
47+
to enable
48+
--help Show this message and exit.
49+
```
50+
2251
- Profit!
2352

2453
# Architecture
2554

2655
The script is split in two parts:
2756

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
57+
- The first part uses `requests` to poll OVH's availability webservice,
58+
and parses its response to find the product you want. When the response
3059
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
60+
- The second part uses `selenium` for opening the listing page, then selects
3261
your product, injects some Angular.JS-specific JavaScript for selecting your
3362
datacenter, waits for PayPal to load, and clicks on Purchase!
3463

0 commit comments

Comments
 (0)