Skip to content

Commit 4680fe8

Browse files
query added
1 parent b0c28d0 commit 4680fe8

File tree

6 files changed

+39
-28
lines changed

6 files changed

+39
-28
lines changed

contentstack/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2424
# SOFTWARE.
2525

26-
"""Export module packages."""
27-
2826
# from .stack import Stack
2927
from .entry import Entry
3028
from .asset import Asset
@@ -38,7 +36,7 @@
3836

3937
__author__ = "Shailesh Mishra <mshaileshr@gmail.com>"
4038
__status__ = "debug"
41-
__date__ = "27 June 2019"
39+
__date__ = "01 July 2019"
4240
__version__ = "1.0.0"
4341
__endpoint__ = "cdn.contentstack.io"
4442

contentstack/asset_library.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525

2626
from contentstack import http_request
2727

28+
"""
29+
contentstack.asset_library
30+
~~~~~~~~~~~~~~~~~~
31+
This module implements the AssetLibrary class.
32+
API Reference: https://www.contentstack.com/docs/apis/content-delivery-api/#assets
33+
34+
"""
35+
36+
2837

2938
class AssetLibrary():
3039

contentstack/http_request.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
from urllib import parse
12
import requests
2-
from urllib3.util import timeout
3+
from requests import Response
34
from contentstack import config
4-
import urllib.parse
5-
import logging
65

76

87
class HTTPRequestConnection(object):
@@ -20,7 +19,11 @@ def __init__(self, url_path, query=dict, local_headers=dict):
2019
self._query_prams['environment'] = self._local_headers['environment']
2120

2221
def http_request(self) -> tuple:
23-
response = requests.get(self.url_path, params=self._query_prams, headers=self._local_headers)
22+
payload = parse.urlencode(query=self._query_prams, encoding='UTF-8')
23+
print("encoded prams", payload)
24+
response: Response = requests.get(self.url_path, params=payload, headers=self._local_headers)
25+
var_url = response.url
26+
2427
if response.ok:
2528
self.result = response.json()
2629
else:

contentstack/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ class utils:
4141
def __init__(self):
4242
log.error('logging called in utils')
4343
pass
44+
4445
'''def is_internet_on():
4546
try: urllib.request.urlopen('http://216.58.192.142', timeout=1)
4647
#return True
4748
except urllib2.URLError as err:
4849
return False'''
4950

5051

51-
util = utils()
52-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "contentstack.py",
2+
"name": "contentstack.python",
33
"version": "1.0.0",
44
"dependencies": {
55

setup.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
"""contentstack - decorator heavy REST client library for Python."""
1+
# !/usr/bin/env python
2+
# distutils/setuptools install script.
23

34
from setuptools import setup, find_packages
45
import os
56
import re
67

8+
ROOT = os.path.dirname(__file__)
9+
VERSION_RE = re.compile(r'''__version__ = ['"]([0-9.]+)['"]''')
10+
11+
12+
def get_version():
13+
init = open(os.path.join(ROOT, 'contentstack', '__init__.py')).read()
14+
return VERSION_RE.search(init).group(1)
15+
16+
717
package = 'contentstack'
818

919

@@ -17,20 +27,12 @@ def read(fname):
1727
'python-dateutil'
1828
]
1929

20-
21-
def get_version():
22-
"""Return package version as listed in `__version__` in `init.py`."""
23-
init_py = open('decorest/__init__.py').read()
24-
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
25-
26-
27-
version = get_version()
28-
2930
setup(
30-
name='contentstack-python',
31-
version=version,
31+
32+
name='contentstack',
33+
version=get_version(),
3234
packages=find_packages(exclude=['tests']),
33-
url='https://www.contentstack.com',
35+
url='https://github.com/contentstack/contentstack-python',
3436
license='MIT License',
3537
author='Shailesh Mishra',
3638
author_email='shailesh.mishra@contentstack.com',
@@ -39,13 +41,13 @@ def get_version():
3941
tests_require=['pytest'],
4042
long_description=read('README.rst'),
4143
include_package_data=True,
44+
4245
classifiers=[
43-
'Development Status :: 1 - Alpha',
46+
"License :: OSI Approved :: MIT License",
47+
"Operating System :: OS Independent",
4448
'Intended Audience :: Developers',
4549
'Natural Language :: English',
46-
'License :: OSI Approved :: MIT License',
47-
'Operating System :: OS Independent',
4850
'Programming Language :: Python',
49-
'Programming Language :: Python :: 3.6'
50-
]
51+
'Programming Language :: Python :: 3.7',
52+
],
5153
)

0 commit comments

Comments
 (0)