Conditions | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
28 | def __init__(self, **kwargs): |
||
29 | region = kwargs.pop('region', None) |
||
30 | base_url = kwargs.pop('base_url', None) |
||
31 | |||
32 | assert region is None or base_url is None, \ |
||
33 | "Specify either region or base_url, not both." |
||
34 | |||
35 | if base_url is None: |
||
36 | region = region or 'par1' |
||
37 | |||
38 | assert region in REGIONS, \ |
||
39 | "'%s' is not a valid Scaleway region." % region |
||
40 | |||
41 | base_url = REGIONS.get(region)['url'] |
||
42 | |||
43 | super(ComputeAPI, self).__init__(base_url=base_url, **kwargs) |
||
44 |