Skip to content

Commit

Permalink
Merge pull request #5 from Ilhasoft/feature/nlp_logs
Browse files Browse the repository at this point in the history
Added router for nlp logs
  • Loading branch information
dyohan9 authored Dec 27, 2019
2 parents 66b121e + 8bae537 commit cdc47e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion bothub_backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def get_langs(self):
pass

@abstractmethod
def request_backend_parse(self, router, repository_authorization, language=None, repository_version=None):
def request_backend_parse(
self, router, repository_authorization, language=None, repository_version=None
):
pass

@abstractmethod
Expand Down Expand Up @@ -88,3 +90,7 @@ def request_backend_repository_entity_nlu_parse(
self, update_id, repository_authorization, entity
):
pass

@abstractmethod
def send_log_nlp_parse(self, data):
pass
17 changes: 16 additions & 1 deletion bothub_backend/bothub.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def request_backend_parse(
if repository_version:
version = requests.get(
"{}/v2/repository/nlp/authorization/{}/{}/?language={}&repository_version={}".format(
self.backend, router, repository_authorization, language, repository_version
self.backend,
router,
repository_authorization,
language,
repository_version,
),
headers={"Authorization": "Bearer {}".format(repository_authorization)},
).json()
Expand Down Expand Up @@ -277,3 +281,14 @@ def request_backend_repository_entity_nlu_parse(
f"End connection request_backend_repository_entity_nlu_parse() {str(time.time() - time_start)}"
)
return update

def send_log_nlp_parse(self, data):
print(f"Starting connection send_log_nlp_parse()")
time_start = time.time()
update = requests.post(
"{}/v2/repository/nlp/log/".format(self.backend),
json=data,
headers={"Content-Type": "application/json",},
).json()
print(f"End connection send_log_nlp_parse() {str(time.time() - time_start)}")
return update
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='bothub_backend',
version='1.0.5',
version='1.0.6',
description='Bothub NLP Backend',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit cdc47e6

Please sign in to comment.