Skip to content

Commit

Permalink
fix data process url
Browse files Browse the repository at this point in the history
  • Loading branch information
yanheven committed Sep 2, 2016
1 parent 14560ee commit c7eb275
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -79,4 +79,4 @@ Apache License Version 2.0
- 1, V2.0.0-dev Provide only few functions of opensearch, not yet cover all functions.
- 2, V2.0.0 completed all api functions.
- 3, V2.0.1 add compatibility for python3.

- 4, v2.0.2 fix data process url
7 changes: 5 additions & 2 deletions demo.py
Expand Up @@ -67,7 +67,7 @@ def creat_data_process(client):
}
]
items = json.dumps(items)
data_ret = client.data.create(table_name, items)
data_ret = client.data.create('test_app', table_name, items)
print(data_ret)
'''
{
Expand Down Expand Up @@ -238,8 +238,11 @@ def get_error_log(client):
key_id = mykey.KEY['key_id']
client = Client(url, key, key_id)
# list_app(client)
# creat_data_process(client)
# create_app(client)

# must create app before create data process

# creat_data_process(client)
# search(client)
# suggest(client)
# index_refactor(client)
Expand Down
7 changes: 5 additions & 2 deletions opensearchsdk/demo.py
Expand Up @@ -67,7 +67,7 @@ def creat_data_process(client):
}
]
items = json.dumps(items)
data_ret = client.data.create(table_name, items)
data_ret = client.data.create('test_app', table_name, items)
print(data_ret)
'''
{
Expand Down Expand Up @@ -238,8 +238,11 @@ def get_error_log(client):
key_id = mykey.KEY['key_id']
client = Client(url, key, key_id)
# list_app(client)
# creat_data_process(client)
# create_app(client)

# must create app before create data process

# creat_data_process(client)
# search(client)
# suggest(client)
# index_refactor(client)
Expand Down
6 changes: 4 additions & 2 deletions opensearchsdk/tests/v2/test_data.py
Expand Up @@ -16,6 +16,8 @@ def setUp(self):
Manager.send_get = Manager.send_post = mock_send

def test_list(self):
resp = self.data_manager.create('1', '2')
resp = self.data_manager.create('a', '1', '2')
self.assertEqual(FAKE_RESP, resp)
Manager.send_post.assert_called_with({'table_name': '1', 'items': '2'})
Manager.send_post.assert_called_with({'table_name': '1',
'items': '2'},
'/a')
6 changes: 4 additions & 2 deletions opensearchsdk/v2/data.py
Expand Up @@ -4,12 +4,14 @@

class DataManager(api_base.Manager):
"""Data Process resource manage class"""
def create(self, table_name, items):
def create(self, app_name, table_name, items):
"""
create data process to application
:param app_name: app name
:param table_name: table name of upload items
:param items: items in json format
:return:{"status":"OK","request_id":"10373587"}
"""
body = dict(table_name=table_name, items=items)
return self.send_post(body)
spec_url = '/' + app_name
return self.send_post(body, spec_url)
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@

setup(
name='ali-opensearch',
version='2.0.1',
version='2.0.2',
packages=find_packages(),
keywords=('OpenSearch SDK', 'Ali Cloud'),
description='Python SDK for OpenSearch of Ali Cloud',
Expand Down

0 comments on commit c7eb275

Please sign in to comment.