diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_1.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_1.json index 3d0bf2e..650f3d9 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_1.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_1.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "You+will+learn+how+to+speak+like+me+someday." + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_2.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_2.json index 0b19a04..b939cca 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_2.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_2.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=you+still+have+much+to+learn", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "you+still+have+much+to+learn" + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_api_key_error.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_api_key_error.json index 352d7f7..f5f49c5 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_api_key_error.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_api_key_error.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "You+will+learn+how+to+speak+like+me+someday." + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_invalid_input.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_invalid_input.json index 4cf71b1..6b04254 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_invalid_input.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_invalid_input.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=@#$%^&*", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "@#$%^&*" + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_only_numbers.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_only_numbers.json index fd1c74f..bbbdd9d 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_only_numbers.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_only_numbers.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=23456", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "23456" + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_service_unavailable_error.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_service_unavailable_error.json index 245f369..90130bc 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_service_unavailable_error.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_service_unavailable_error.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "You+will+learn+how+to+speak+like+me+someday." + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_unknown_error.json b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_unknown_error.json index 43c8b4c..d05c118 100644 --- a/zulip_bots/zulip_bots/bots/yoda/fixtures/test_unknown_error.json +++ b/zulip_bots/zulip_bots/bots/yoda/fixtures/test_unknown_error.json @@ -1,6 +1,9 @@ { "request": { - "api_url": "https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.", + "api_url": "https://yoda.p.mashape.com/yoda", + "params": { + "sentence": "You+will+learn+how+to+speak+like+me+someday." + }, "headers": { "X-Mashape-Key": "12345678", "Accept": "text/plain" diff --git a/zulip_bots/zulip_bots/bots/yoda/yoda.py b/zulip_bots/zulip_bots/bots/yoda/yoda.py index 5e77f53..4f535a9 100644 --- a/zulip_bots/zulip_bots/bots/yoda/yoda.py +++ b/zulip_bots/zulip_bots/bots/yoda/yoda.py @@ -55,7 +55,8 @@ class YodaSpeakHandler(object): def send_to_yoda_api(self, sentence: str) -> str: # function for sending sentence to api - response = requests.get("https://yoda.p.mashape.com/yoda?sentence=" + sentence, + response = requests.get("https://yoda.p.mashape.com/yoda", + params=dict(sentence=sentence), headers={ "X-Mashape-Key": self.api_key, "Accept": "text/plain"