Skip to content

Commit 1550f05

Browse files
author
skamieniarz
committed
Store base API URL in config
1 parent 4849d47 commit 1550f05

20 files changed

+108
-92
lines changed

configs/main.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
[api_versions]
1+
[api]
2+
url = api.livechatinc.com
23
stable = 3.4
3-
dev = 3.5
4+
dev = 3.5

docs/agent_rtm.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@ <h1 class="title">Module <code>client</code></h1>
4141

4242
config = ConfigParser()
4343
config.read(&#39;configs/main.ini&#39;)
44-
stable_version = config.get(&#39;api_versions&#39;, &#39;stable&#39;)
44+
stable_version = config.get(&#39;api&#39;, &#39;stable&#39;)
45+
api_url = config.get(&#39;api&#39;, &#39;url&#39;)
4546

4647

4748
class AgentRTM:
4849
&#39;&#39;&#39; Main class that gets specific client. &#39;&#39;&#39;
4950
@staticmethod
5051
def get_client(version: str = stable_version,
51-
base_url: str = &#39;api.livechatinc.com&#39;) -&gt; AgentRTMInterface:
52+
base_url: str = api_url) -&gt; AgentRTMInterface:
5253
&#39;&#39;&#39; Returns client for specific Agent RTM version.
5354

5455
Args:
5556
version (str): API&#39;s version. Defaults to the stable version of API.
56-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
57+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
5758

5859
Returns:
5960
AgentRTMInterface: API client object for specified version.
@@ -1176,12 +1177,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
11761177
&#39;&#39;&#39; Main class that gets specific client. &#39;&#39;&#39;
11771178
@staticmethod
11781179
def get_client(version: str = stable_version,
1179-
base_url: str = &#39;api.livechatinc.com&#39;) -&gt; AgentRTMInterface:
1180+
base_url: str = api_url) -&gt; AgentRTMInterface:
11801181
&#39;&#39;&#39; Returns client for specific Agent RTM version.
11811182

11821183
Args:
11831184
version (str): API&#39;s version. Defaults to the stable version of API.
1184-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1185+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
11851186

11861187
Returns:
11871188
AgentRTMInterface: API client object for specified version.
@@ -1210,7 +1211,7 @@ <h2 id="args">Args</h2>
12101211
<dt><strong><code>version</code></strong> :&ensp;<code>str</code></dt>
12111212
<dd>API's version. Defaults to the stable version of API.</dd>
12121213
<dt><strong><code>base_url</code></strong> :&ensp;<code>str</code></dt>
1213-
<dd>API's base url. Defaults to <code>api.livechatinc.com</code>.</dd>
1214+
<dd>API's base url. Defaults to API's production URL.</dd>
12141215
</dl>
12151216
<h2 id="returns">Returns</h2>
12161217
<dl>
@@ -1228,12 +1229,12 @@ <h2 id="raises">Raises</h2>
12281229
</summary>
12291230
<pre><code class="python">@staticmethod
12301231
def get_client(version: str = stable_version,
1231-
base_url: str = &#39;api.livechatinc.com&#39;) -&gt; AgentRTMInterface:
1232+
base_url: str = api_url) -&gt; AgentRTMInterface:
12321233
&#39;&#39;&#39; Returns client for specific Agent RTM version.
12331234

12341235
Args:
12351236
version (str): API&#39;s version. Defaults to the stable version of API.
1236-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1237+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
12371238

12381239
Returns:
12391240
AgentRTMInterface: API client object for specified version.

docs/agent_web.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ <h1 class="title">Module <code>client</code></h1>
4343

4444
config = ConfigParser()
4545
config.read(&#39;configs/main.ini&#39;)
46-
stable_version = config.get(&#39;api_versions&#39;, &#39;stable&#39;)
47-
46+
stable_version = config.get(&#39;api&#39;, &#39;stable&#39;)
47+
api_url = config.get(&#39;api&#39;, &#39;url&#39;)
4848

4949
# pylint: disable=R0903
5050
class AgentWeb:
@@ -53,15 +53,15 @@ <h1 class="title">Module <code>client</code></h1>
5353
@staticmethod
5454
def get_client(access_token: str,
5555
version: str = stable_version,
56-
base_url: str = &#39;api.livechatinc.com&#39;,
56+
base_url: str = api_url,
5757
http2: bool = False) -&gt; AgentWebInterface:
5858
&#39;&#39;&#39; Returns client for specific API version.
5959

6060
Args:
6161
token (str): Full token with type (Bearer/Basic) that will be
6262
used as `Authorization` header in requests to API.
6363
version (str): API&#39;s version. Defaults to the stable version of API.
64-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
64+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
6565
http2 (bool): A boolean indicating if HTTP/2 support should be
6666
enabled. Defaults to `False`.
6767

@@ -1403,15 +1403,15 @@ <h2 class="section-title" id="header-classes">Classes</h2>
14031403
@staticmethod
14041404
def get_client(access_token: str,
14051405
version: str = stable_version,
1406-
base_url: str = &#39;api.livechatinc.com&#39;,
1406+
base_url: str = api_url,
14071407
http2: bool = False) -&gt; AgentWebInterface:
14081408
&#39;&#39;&#39; Returns client for specific API version.
14091409

14101410
Args:
14111411
token (str): Full token with type (Bearer/Basic) that will be
14121412
used as `Authorization` header in requests to API.
14131413
version (str): API&#39;s version. Defaults to the stable version of API.
1414-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1414+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
14151415
http2 (bool): A boolean indicating if HTTP/2 support should be
14161416
enabled. Defaults to `False`.
14171417

@@ -1446,7 +1446,7 @@ <h2 id="args">Args</h2>
14461446
<dt><strong><code>version</code></strong> :&ensp;<code>str</code></dt>
14471447
<dd>API's version. Defaults to the stable version of API.</dd>
14481448
<dt><strong><code>base_url</code></strong> :&ensp;<code>str</code></dt>
1449-
<dd>API's base url. Defaults to <code>api.livechatinc.com</code>.</dd>
1449+
<dd>API's base url. Defaults to API's production URL.</dd>
14501450
<dt><strong><code>http2</code></strong> :&ensp;<code>bool</code></dt>
14511451
<dd>A boolean indicating if HTTP/2 support should be
14521452
enabled. Defaults to <code>False</code>.</dd>
@@ -1466,15 +1466,15 @@ <h2 id="raises">Raises</h2>
14661466
<pre><code class="python">@staticmethod
14671467
def get_client(access_token: str,
14681468
version: str = stable_version,
1469-
base_url: str = &#39;api.livechatinc.com&#39;,
1469+
base_url: str = api_url,
14701470
http2: bool = False) -&gt; AgentWebInterface:
14711471
&#39;&#39;&#39; Returns client for specific API version.
14721472

14731473
Args:
14741474
token (str): Full token with type (Bearer/Basic) that will be
14751475
used as `Authorization` header in requests to API.
14761476
version (str): API&#39;s version. Defaults to the stable version of API.
1477-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1477+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
14781478
http2 (bool): A boolean indicating if HTTP/2 support should be
14791479
enabled. Defaults to `False`.
14801480

docs/configuration_api.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ <h1 class="title">Module <code>client</code></h1>
4242

4343
config = ConfigParser()
4444
config.read(&#39;configs/main.ini&#39;)
45-
stable_version = config.get(&#39;api_versions&#39;, &#39;stable&#39;)
45+
stable_version = config.get(&#39;api&#39;, &#39;stable&#39;)
46+
api_url = config.get(&#39;api&#39;, &#39;url&#39;)
4647

4748

4849
class ConfigurationApi:
@@ -51,15 +52,15 @@ <h1 class="title">Module <code>client</code></h1>
5152
@staticmethod
5253
def get_client(token: str,
5354
version: str = stable_version,
54-
base_url: str = &#39;api.livechatinc.com&#39;,
55+
base_url: str = api_url,
5556
http2: bool = False) -&gt; ConfigurationApiInterface:
5657
&#39;&#39;&#39; Returns client for specific Configuration API version.
5758

5859
Args:
5960
token (str): Full token with type (Bearer/Basic) that will be
6061
used as `Authorization` header in requests to API.
6162
version (str): API&#39;s version. Defaults to the stable version of API.
62-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
63+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
6364
http2 (bool): A boolean indicating if HTTP/2 support should be
6465
enabled. Defaults to `False`.
6566

@@ -1328,15 +1329,15 @@ <h2 class="section-title" id="header-classes">Classes</h2>
13281329
@staticmethod
13291330
def get_client(token: str,
13301331
version: str = stable_version,
1331-
base_url: str = &#39;api.livechatinc.com&#39;,
1332+
base_url: str = api_url,
13321333
http2: bool = False) -&gt; ConfigurationApiInterface:
13331334
&#39;&#39;&#39; Returns client for specific Configuration API version.
13341335

13351336
Args:
13361337
token (str): Full token with type (Bearer/Basic) that will be
13371338
used as `Authorization` header in requests to API.
13381339
version (str): API&#39;s version. Defaults to the stable version of API.
1339-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1340+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
13401341
http2 (bool): A boolean indicating if HTTP/2 support should be
13411342
enabled. Defaults to `False`.
13421343

@@ -1370,7 +1371,7 @@ <h2 id="args">Args</h2>
13701371
<dt><strong><code>version</code></strong> :&ensp;<code>str</code></dt>
13711372
<dd>API's version. Defaults to the stable version of API.</dd>
13721373
<dt><strong><code>base_url</code></strong> :&ensp;<code>str</code></dt>
1373-
<dd>API's base url. Defaults to <code>api.livechatinc.com</code>.</dd>
1374+
<dd>API's base url. Defaults to API's production URL.</dd>
13741375
<dt><strong><code>http2</code></strong> :&ensp;<code>bool</code></dt>
13751376
<dd>A boolean indicating if HTTP/2 support should be
13761377
enabled. Defaults to <code>False</code>.</dd>
@@ -1392,15 +1393,15 @@ <h2 id="raises">Raises</h2>
13921393
<pre><code class="python">@staticmethod
13931394
def get_client(token: str,
13941395
version: str = stable_version,
1395-
base_url: str = &#39;api.livechatinc.com&#39;,
1396+
base_url: str = api_url,
13961397
http2: bool = False) -&gt; ConfigurationApiInterface:
13971398
&#39;&#39;&#39; Returns client for specific Configuration API version.
13981399

13991400
Args:
14001401
token (str): Full token with type (Bearer/Basic) that will be
14011402
used as `Authorization` header in requests to API.
14021403
version (str): API&#39;s version. Defaults to the stable version of API.
1403-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1404+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
14041405
http2 (bool): A boolean indicating if HTTP/2 support should be
14051406
enabled. Defaults to `False`.
14061407

docs/customer_rtm.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,23 @@ <h1 class="title">Module <code>client</code></h1>
4141

4242
config = ConfigParser()
4343
config.read(&#39;configs/main.ini&#39;)
44-
stable_version = config.get(&#39;api_versions&#39;, &#39;stable&#39;)
44+
stable_version = config.get(&#39;api&#39;, &#39;stable&#39;)
45+
api_url = config.get(&#39;api&#39;, &#39;url&#39;)
4546

4647

4748
class CustomerRTM:
4849
&#39;&#39;&#39; Main class that gets specific client. &#39;&#39;&#39;
4950
@staticmethod
5051
def get_client(license_id: int = None,
5152
version: str = stable_version,
52-
base_url: str = &#39;api.livechatinc.com&#39;,
53+
base_url: str = api_url,
5354
organization_id: str = None) -&gt; CustomerRTMInterface:
5455
&#39;&#39;&#39; Returns client for specific Customer RTM version.
5556

5657
Args:
5758
license_id (int): License ID. Required to use for API version &lt;= 3.3.
5859
version (str): API&#39;s version. Defaults to the stable version of API.
59-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
60+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
6061
organization_id (str): Organization ID, replaced license ID in v3.4.
6162

6263
Returns:
@@ -743,14 +744,14 @@ <h2 class="section-title" id="header-classes">Classes</h2>
743744
@staticmethod
744745
def get_client(license_id: int = None,
745746
version: str = stable_version,
746-
base_url: str = &#39;api.livechatinc.com&#39;,
747+
base_url: str = api_url,
747748
organization_id: str = None) -&gt; CustomerRTMInterface:
748749
&#39;&#39;&#39; Returns client for specific Customer RTM version.
749750

750751
Args:
751752
license_id (int): License ID. Required to use for API version &lt;= 3.3.
752753
version (str): API&#39;s version. Defaults to the stable version of API.
753-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
754+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
754755
organization_id (str): Organization ID, replaced license ID in v3.4.
755756

756757
Returns:
@@ -799,7 +800,7 @@ <h2 id="args">Args</h2>
799800
<dt><strong><code>version</code></strong> :&ensp;<code>str</code></dt>
800801
<dd>API's version. Defaults to the stable version of API.</dd>
801802
<dt><strong><code>base_url</code></strong> :&ensp;<code>str</code></dt>
802-
<dd>API's base url. Defaults to <code>api.livechatinc.com</code>.</dd>
803+
<dd>API's base url. Defaults to API's production URL.</dd>
803804
<dt><strong><code>organization_id</code></strong> :&ensp;<code>str</code></dt>
804805
<dd>Organization ID, replaced license ID in v3.4.</dd>
805806
</dl>
@@ -820,14 +821,14 @@ <h2 id="raises">Raises</h2>
820821
<pre><code class="python">@staticmethod
821822
def get_client(license_id: int = None,
822823
version: str = stable_version,
823-
base_url: str = &#39;api.livechatinc.com&#39;,
824+
base_url: str = api_url,
824825
organization_id: str = None) -&gt; CustomerRTMInterface:
825826
&#39;&#39;&#39; Returns client for specific Customer RTM version.
826827

827828
Args:
828829
license_id (int): License ID. Required to use for API version &lt;= 3.3.
829830
version (str): API&#39;s version. Defaults to the stable version of API.
830-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
831+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
831832
organization_id (str): Organization ID, replaced license ID in v3.4.
832833

833834
Returns:

docs/customer_web.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ <h1 class="title">Module <code>client</code></h1>
4343

4444
config = ConfigParser()
4545
config.read(&#39;configs/main.ini&#39;)
46-
stable_version = config.get(&#39;api_versions&#39;, &#39;stable&#39;)
46+
stable_version = config.get(&#39;api&#39;, &#39;stable&#39;)
47+
api_url = config.get(&#39;api&#39;, &#39;url&#39;)
4748

4849

4950
# pylint: disable=R0903
@@ -54,7 +55,7 @@ <h1 class="title">Module <code>client</code></h1>
5455
def get_client(license_id: int = None,
5556
access_token: str = None,
5657
version: str = stable_version,
57-
base_url: str = &#39;api.livechatinc.com&#39;,
58+
base_url: str = api_url,
5859
http2: bool = False,
5960
organization_id: str = None) -&gt; CustomerWebInterface:
6061
&#39;&#39;&#39; Returns client for specific API version.
@@ -64,7 +65,7 @@ <h1 class="title">Module <code>client</code></h1>
6465
token (str): Full token with type (Bearer/Basic) that will be
6566
used as `Authorization` header in requests to API.
6667
version (str): API&#39;s version. Defaults to the stable version of API.
67-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
68+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
6869
http2 (bool): A boolean indicating if HTTP/2 support should be
6970
enabled. Defaults to `False`.
7071
organization_id (str): Organization ID, replaced license ID in v3.4.
@@ -1265,7 +1266,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
12651266
def get_client(license_id: int = None,
12661267
access_token: str = None,
12671268
version: str = stable_version,
1268-
base_url: str = &#39;api.livechatinc.com&#39;,
1269+
base_url: str = api_url,
12691270
http2: bool = False,
12701271
organization_id: str = None) -&gt; CustomerWebInterface:
12711272
&#39;&#39;&#39; Returns client for specific API version.
@@ -1275,7 +1276,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
12751276
token (str): Full token with type (Bearer/Basic) that will be
12761277
used as `Authorization` header in requests to API.
12771278
version (str): API&#39;s version. Defaults to the stable version of API.
1278-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1279+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
12791280
http2 (bool): A boolean indicating if HTTP/2 support should be
12801281
enabled. Defaults to `False`.
12811282
organization_id (str): Organization ID, replaced license ID in v3.4.
@@ -1336,7 +1337,7 @@ <h2 id="args">Args</h2>
13361337
<dt><strong><code>version</code></strong> :&ensp;<code>str</code></dt>
13371338
<dd>API's version. Defaults to the stable version of API.</dd>
13381339
<dt><strong><code>base_url</code></strong> :&ensp;<code>str</code></dt>
1339-
<dd>API's base url. Defaults to <code>api.livechatinc.com</code>.</dd>
1340+
<dd>API's base url. Defaults to API's production URL.</dd>
13401341
<dt><strong><code>http2</code></strong> :&ensp;<code>bool</code></dt>
13411342
<dd>A boolean indicating if HTTP/2 support should be
13421343
enabled. Defaults to <code>False</code>.</dd>
@@ -1359,7 +1360,7 @@ <h2 id="raises">Raises</h2>
13591360
def get_client(license_id: int = None,
13601361
access_token: str = None,
13611362
version: str = stable_version,
1362-
base_url: str = &#39;api.livechatinc.com&#39;,
1363+
base_url: str = api_url,
13631364
http2: bool = False,
13641365
organization_id: str = None) -&gt; CustomerWebInterface:
13651366
&#39;&#39;&#39; Returns client for specific API version.
@@ -1369,7 +1370,7 @@ <h2 id="raises">Raises</h2>
13691370
token (str): Full token with type (Bearer/Basic) that will be
13701371
used as `Authorization` header in requests to API.
13711372
version (str): API&#39;s version. Defaults to the stable version of API.
1372-
base_url (str): API&#39;s base url. Defaults to `api.livechatinc.com`.
1373+
base_url (str): API&#39;s base url. Defaults to API&#39;s production URL.
13731374
http2 (bool): A boolean indicating if HTTP/2 support should be
13741375
enabled. Defaults to `False`.
13751376
organization_id (str): Organization ID, replaced license ID in v3.4.

0 commit comments

Comments
 (0)