Skip to content

Commit b87fa07

Browse files
author
Ervin Papp
committed
RCB-601 new: events endpoint
1 parent 37c21ef commit b87fa07

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

rosette/api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ def __init__(
589589
'TEXT_EMBEDDING': 'semantics/vector',
590590
'TOKENS': 'tokens',
591591
'TOPICS': 'topics',
592-
'TRANSLITERATION': 'transliteration'
592+
'TRANSLITERATION': 'transliteration',
593+
'EVENTS': 'events'
593594
}
594595

595596
def __del__(self):
@@ -1010,3 +1011,11 @@ def similar_terms(self, parameters):
10101011
:return: A python dictionary containing the similar terms and their similarity
10111012
"""
10121013
return EndpointCaller(self, self.endpoints['SIMILAR_TERMS']).call(parameters)
1014+
1015+
def events(self, parameters):
1016+
"""
1017+
Topics returns events related to the provided content
1018+
:param parameters: DocumentParameters
1019+
:return: A python dictionary containing the results
1020+
"""
1021+
return EndpointCaller(self, self.endpoints['EVENTS']).call(parameters)

tests/test_rosette_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,3 +882,19 @@ def test_the_deprecated_endpoints(api, json_response, doc_params):
882882

883883
httpretty.disable()
884884
httpretty.reset()
885+
886+
# Test the events endpoint
887+
888+
889+
def test_the_events_endpoint(api, json_response, doc_params):
890+
"""Test the events endpoint"""
891+
httpretty.enable()
892+
httpretty.register_uri(httpretty.POST, "https://api.rosette.com/rest/v1/info",
893+
body=json_response, status=200, content_type="application/json")
894+
httpretty.register_uri(httpretty.POST, "https://api.rosette.com/rest/v1/events",
895+
body=json_response, status=200, content_type="application/json")
896+
897+
result = api.events(doc_params)
898+
assert result["name"] == "Rosette"
899+
httpretty.disable()
900+
httpretty.reset()

0 commit comments

Comments
 (0)