yoda: Pass API query parameters as params
dict in requests.get().
This commit is contained in:
parent
5ad5e11587
commit
65ebd6e595
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"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": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"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": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"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": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"request": {
|
||||||
"api_url": "https://yoda.p.mashape.com/yoda?sentence=@#$%^&*",
|
"api_url": "https://yoda.p.mashape.com/yoda",
|
||||||
|
"params": {
|
||||||
|
"sentence": "@#$%^&*"
|
||||||
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"request": {
|
||||||
"api_url": "https://yoda.p.mashape.com/yoda?sentence=23456",
|
"api_url": "https://yoda.p.mashape.com/yoda",
|
||||||
|
"params": {
|
||||||
|
"sentence": "23456"
|
||||||
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"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": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"request": {
|
"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": {
|
"headers": {
|
||||||
"X-Mashape-Key": "12345678",
|
"X-Mashape-Key": "12345678",
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
|
@ -55,7 +55,8 @@ class YodaSpeakHandler(object):
|
||||||
|
|
||||||
def send_to_yoda_api(self, sentence: str) -> str:
|
def send_to_yoda_api(self, sentence: str) -> str:
|
||||||
# function for sending sentence to api
|
# 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={
|
headers={
|
||||||
"X-Mashape-Key": self.api_key,
|
"X-Mashape-Key": self.api_key,
|
||||||
"Accept": "text/plain"
|
"Accept": "text/plain"
|
||||||
|
|
Loading…
Reference in a new issue