Skip to content

Commit 9799c2a

Browse files
mshaileshr@gmail.commshaileshr@gmail.com
authored andcommitted
docstring
1 parent 03f4b36 commit 9799c2a

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

contentstack/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
contentstack
55
Created by Shailesh Mishra on 22/06/19.
66
Copyright 2019 Contentstack. All rights reserved.
7-
87
"""
98

109
import warnings

contentstack/contentstack.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
contentstack
3+
Created by Shailesh Mishra on 13/08/19.
4+
Copyright 2019 Contentstack. All rights reserved.
5+
6+
"""
7+
import stack
8+
9+
10+
class contentstack(object):
11+
12+
"""
13+
:param api_key: api_key of your target stack.
14+
:param access_token: access token for the stack.
15+
:param environment: environment of the stack
16+
:param config: (optional) contains configuration of the stack
17+
"""
18+
19+
@staticmethod
20+
def stack(**kwargs):
21+
initstack = stack.Stack(**kwargs)
22+
return initstack
23+
24+
25+
26+

contentstack/errors.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,25 @@
88

99
import os
1010
import sys
11+
1112
sys.path.insert(0, os.path.abspath('.'))
1213

13-
class Error:
1414

15+
class Error:
1516
"""
16-
contentstack.error
17+
>>> error = Error()
1718
~~~~~~~~~~~~~~~~~~
1819
This module implements the Error class.
1920
API Reference: https://www.contentstack.com/docs/apis/content-delivery-api/#error
2021
2122
"""
2223

2324
def __init__(self):
24-
# It has some values to set error_msg, error_code etc..
2525
self.__error_dict = {}
2626
self.__error_code = str
2727
self.__msg = str
2828

2929
def _config(self, result: dict):
30-
# config error information
3130
if result is not None and len(result) > 0:
3231
self.__error_dict = result
3332
self.__error_code = self.__error_dict['error_code']
@@ -36,7 +35,6 @@ def _config(self, result: dict):
3635

3736
@property
3837
def error_code(self):
39-
4038
"""
4139
It returns error code from the stack response
4240
:return: error_code as int
@@ -46,15 +44,14 @@ def error_code(self):
4644
4745
[Example:]
4846
49-
>>> code = error.error_code
47+
>>> code = Error.error_code
5048
5149
==============================
5250
"""
5351
return self.__error_code
5452

5553
@property
5654
def error_message(self):
57-
5855
"""
5956
Returns error_message from the stack response
6057
:return: error_message
@@ -64,7 +61,7 @@ def error_message(self):
6461
6562
[Example:]
6663
67-
>>> message = error.error_message
64+
>>> message = Error.error_message
6865
6966
==============================
7067
"""
@@ -73,7 +70,6 @@ def error_message(self):
7370

7471
@property
7572
def error(self):
76-
7773
"""
7874
This returns error code and error_message in dict formats
7975
:return: error dict
@@ -83,7 +79,7 @@ def error(self):
8379
8480
[Example:]
8581
86-
>>> ode = error.error
82+
>>> ode = Error.error
8783
8884
==============================
8985
"""
@@ -92,7 +88,6 @@ def error(self):
9288

9389
@property
9490
def error_info(self) -> dict:
95-
9691
"""
9792
error information
9893
:return: error information
@@ -102,7 +97,7 @@ def error_info(self) -> dict:
10297
10398
[Example:]
10499
105-
>>> ode = error.error_info
100+
>>> ode = Error.error_info
106101
107102
==============================
108103
"""

contentstack/http_connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def __parse_assets(result):
137137

138138
@staticmethod
139139
def __user_agents() -> dict:
140+
140141
import contentstack
141142
import platform
142143

0 commit comments

Comments
 (0)