Skip to content

Commit 5b035bb

Browse files
entry functions added
1 parent 4f30214 commit 5b035bb

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

contentstack/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .stack import Stack
21
from .entry import Entry
32
from .asset import Asset
43
from .asset_library import AssetLibrary

contentstack/http_request.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import requests
2+
from urllib3.util import timeout
23
from contentstack import config
34
import urllib.parse
45
import logging
@@ -10,12 +11,11 @@ def __init__(self, url_path, query=dict, local_headers=dict):
1011
self.url_path = url_path
1112
self._query_prams = query
1213
self._local_headers = local_headers
14+
self.url_path = config.Config().get_endpoint(self.url_path)
1315
if 'environment' in self._local_headers:
1416
self._query_prams['environment'] = self._local_headers['environment']
15-
self.url_path = config.Config().get_endpoint(self.url_path)
1617

1718
def http_request(self) -> dict:
18-
1919
self._local_headers['X-User-Agent'] = self._contentstack_user_agent()
2020
self._local_headers['Content-Type'] = 'application/json'
2121
response = requests.get(self.url_path, params=self._query_prams, headers=self._local_headers)
@@ -27,11 +27,21 @@ def http_request(self) -> dict:
2727
logging.info('stack response')
2828
return json_response['stack']
2929
if 'content_types' in json_response:
30-
logging.info('content type response')
30+
logging.info('contenttypes response')
3131
return json_response['content_types']
3232
if 'items' in json_response:
3333
logging.info('sync response')
3434
return json_response['items']
35+
if 'content_type' in json_response:
36+
logging.info('content type response')
37+
return json_response['content_type']
38+
if 'entry' in json_response:
39+
logging.info('entry response')
40+
return json_response['entry']
41+
if 'entries' in json_response:
42+
logging.info('entries response')
43+
return json_response['entries']
44+
3545
else:
3646
error_response = response.json()
3747
# error_message = error_response["error_message"]

runtests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from unittest import main
2-
from tests import *
32

43
main()

setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
from setuptools import setup
2-
32
package = 'contentstack'
43
requirements = [
54
'requests>=2.20.0,<3.0',
65
'python-dateutil'
76
]
87
setup(
98
name='contentstack-python',
10-
version='',
9+
version='1.0.0',
1110
packages=['contentstack', 'doc', 'tests'],
12-
url='',
13-
license='',
14-
author='shailesh-mishra',
15-
author_email='',
16-
description='', install_requires=['requests', 'config']
11+
url='https://www.contentstack.com',
12+
license='MIT License',
13+
author='Shailesh Mishra',
14+
author_email='shailesh.mishra@contentstack.com',
15+
description='Create python-based applications and use the python SDK to fetch and deliver content from Contentstack. The SDK uses Content Delivery APIs. ',
16+
install_requires=['requests', 'config']
1717
)
18+

0 commit comments

Comments
 (0)