-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.py
14 lines (10 loc) · 3.89 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests
url = "http://watson-twilio-demo-app.mybluemix.net/api/message"
payload = "Body=We%20are%20doing%20it!&AddOns=%7B%22status%22%3A%22successful%22%2C%22message%22%3Anull%2C%22code%22%3Anull%2C%22results%22%3A%7B%22ibm_watson_insights%22%3A%7B%22request_sid%22%3A%22XR80a29147ce6c2ffb5b212cb371ecfccd%22%2C%22status%22%3A%22successful%22%2C%22message%22%3Anull%2C%22code%22%3Anull%2C%22result%22%3A%7B%22status%22%3A%22OK%22%2C%22usage%22%3A%22By%20accessing%20AlchemyAPI%20or%20using%20information%20generated%20by%20AlchemyAPI%2C%20you%20are%20agreeing%20to%20be%20bound%20by%20the%20AlchemyAPI%20Terms%20of%20Use%3A%20http%3A%2F%2Fwww.alchemyapi.com%2Fcompany%2Fterms.html%22%2C%22totalTransactions%22%3A%225%22%2C%22language%22%3A%22english%22%2C%22keywords%22%3A%5B%7B%22text%22%3A%22IBM%20Watson%22%2C%22relevance%22%3A%220.958618%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.549193%22%7D%7D%2C%7B%22text%22%3A%22Tuesday%22%2C%22relevance%22%3A%220.753185%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.734057%22%7D%7D%2C%7B%22text%22%3A%22Twilio%22%2C%22relevance%22%3A%220.567973%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.549193%22%7D%7D%2C%7B%22text%22%3A%22fun%22%2C%22relevance%22%3A%220.563158%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.734057%22%7D%7D%5D%2C%22concepts%22%3A%5B%7B%22text%22%3A%22Thomas%20J.%20Watson%22%2C%22relevance%22%3A%220.926128%22%2C%22dbpedia%22%3A%22http%3A%2F%2Fdbpedia.org%2Fresource%2FThomas_J._Watson%22%2C%22freebase%22%3A%22http%3A%2F%2Frdf.freebase.com%2Fns%2Fm.07qkt%22%2C%22yago%22%3A%22http%3A%2F%2Fyago-knowledge.org%2Fresource%2FThomas_J._Watson%22%7D%2C%7B%22text%22%3A%22Lotus%20Software%22%2C%22relevance%22%3A%220.881696%22%2C%22website%22%3A%22http%3A%2F%2Fwww.ibm.com%2Fsoftware%2Flotus%22%2C%22dbpedia%22%3A%22http%3A%2F%2Fdbpedia.org%2Fresource%2FLotus_Software%22%2C%22freebase%22%3A%22http%3A%2F%2Frdf.freebase.com%2Fns%2Fm.0q4jd%22%2C%22opencyc%22%3A%22http%3A%2F%2Fsw.opencyc.org%2Fconcept%2FMx4rvViJIZwpEbGdrcN5Y29ycA%22%2C%22yago%22%3A%22http%3A%2F%2Fyago-knowledge.org%2Fresource%2FLotus_Software%22%7D%2C%7B%22text%22%3A%22Thomas%20J.%20Watson%20Research%20Center%22%2C%22relevance%22%3A%220.7476%22%2C%22dbpedia%22%3A%22http%3A%2F%2Fdbpedia.org%2Fresource%2FThomas_J._Watson_Research_Center%22%2C%22freebase%22%3A%22http%3A%2F%2Frdf.freebase.com%2Fns%2Fm.04zkt5%22%2C%22yago%22%3A%22http%3A%2F%2Fyago-knowledge.org%2Fresource%2FThomas_J._Watson_Research_Center%22%7D%5D%2C%22entities%22%3A%5B%7B%22type%22%3A%22Company%22%2C%22relevance%22%3A%220.983113%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.549193%22%7D%2C%22count%22%3A%221%22%2C%22text%22%3A%22IBM%20Watson%22%7D%2C%7B%22type%22%3A%22Person%22%2C%22relevance%22%3A%220.156036%22%2C%22sentiment%22%3A%7B%22type%22%3A%22positive%22%2C%22score%22%3A%220.549193%22%7D%2C%22count%22%3A%221%22%2C%22text%22%3A%22Twilio%22%7D%5D%7D%7D%2C%22ibm_watson_sentiment%22%3A%7B%22request_sid%22%3A%22XRfc23a21f213c62bdfa678e36d255684f%22%2C%22status%22%3A%22successful%22%2C%22message%22%3Anull%2C%22code%22%3Anull%2C%22result%22%3A%7B%22status%22%3A%22OK%22%2C%22usage%22%3A%22By%20accessing%20AlchemyAPI%20or%20using%20information%20generated%20by%20AlchemyAPI%2C%20you%20are%20agreeing%20to%20be%20bound%20by%20the%20AlchemyAPI%20Terms%20of%20Use%3A%20http%3A%2F%2Fwww.alchemyapi.com%2Fcompany%2Fterms.html%22%2C%22totalTransactions%22%3A%221%22%2C%22language%22%3A%22english%22%2C%22docSentiment%22%3A%7B%22score%22%3A%220.75996%22%2C%22type%22%3A%22positive%22%7D%7D%7D%7D%7D&From=%2B12242136731&FromCity=Highland%20Park&FromState=IL"
headers = {
'content-type': "application/x-www-form-urlencoded",
'cache-control': "no-cache",
'postman-token': "486e98e9-9efb-2e86-39f5-bea611195bfc"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)