ashim888 / awis

A python script to query Amazon's Alexa Web Information Service (AWIS).
GNU General Public License v3.0
37 stars 18 forks source link

How do I get the actual data? #3

Closed mikkokotila closed 7 years ago

mikkokotila commented 7 years ago

Thanks a lot for creating this package! I might be missing something obvious as I was not able to get the actual data from Alexa.

I did get a positive response (just no actual data) using this:

obj=CallAwis('cnn.com','History',access_key_id,secret_access_key)

and then this:

obj.traffichistory()

In which case I get the response:

<?xml version="1.0" encoding="unicode-escape"?>\n<aws:TrafficHistoryResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/"><Response><OperationRequest><RequestId>01c60df3-0086-ea87-5331-38811f0f7cca</RequestId></OperationRequest><TrafficHistoryResult><Alexa>\n<TrafficHistory>\n<Range>31</Range>\n<Site>www.cnn.com</Site>\n<Start>2007-08-01</Start>\n<HistoricalData/>\n</TrafficHistory>\n</Alexa></TrafficHistoryResult><aws:ResponseStatus><aws:StatusCode>Success</aws:StatusCode></aws:ResponseStatus></Response></aws:TrafficHistoryResponse>

Maybe it would help to include some expected outputs in the README to avoid doubt.

ashim888 commented 7 years ago

@mikkokotila like you've mentioned there was infact a positive response but the data wasn't coming right. I've got another work around for you, looking at the original documentation provided by AWIS, you can also use urlinfo() function while passing a response group "TrafficData" this would be obj=CallAwis('cnn.com','TrafficData',access_key_id,secret_access_key) and then, obj.urlinfo()

Actually i've included short description in README.md file which i think would be necessary for making a request, if there's any confusion please refer to API documentation https://docs.aws.amazon.com/AlexaWebInfoService/latest/ or else comment me here i'll reply ASAP

jimmyVadako commented 6 years ago

Im with python 3 I have made some changes to your files but when I try this.

from myawis import *

Access_Key_ID="x" Secret_Access_Key="x" URLINFO_RESPONSE_GROUPS="History" RANGE=str(30) START=str(20180128) obj = CallAwis('www.ripple.com',URLINFO_RESPONSE_GROUPS, Access_Key_ID, Secret_Access_Key)

print(obj)

print(obj.traffichistory(RANGE,START))

I get this error:

aws:Responseaws:ResponseStatusaws:StatusCodeAlexaErroraws:StatusMessageRequest could not be execute due to an Alexa error