ashim888 / awis Goto Github PK
View Code? Open in Web Editor NEWA python script to query Amazon's Alexa Web Information Service (AWIS).
License: GNU General Public License v3.0
A python script to query Amazon's Alexa Web Information Service (AWIS).
License: GNU General Public License v3.0
cat_browse
should call 'CategoryBrowse' not 'CategoryListings'domain
is unused (and doesn't make any sense for either call)I want to get the categories but it returns Nothing. Do you know the reasons?
obj.urlinfo("www.instagram.com", response_group="Categories")
<?xml version="1.0" encoding="utf-8"?>
<aws:UrlInfoResponse xmlns:aws="http://awis.amazonaws.com/doc/2005-10-05">
<aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11">
<aws:OperationRequest>
<aws:RequestId>f2a24d64-4970-4f62-8bbe-1644ad6d7546</aws:RequestId>
</aws:OperationRequest>
<aws:UrlInfoResult>
<aws:Alexa>
<aws:Request>
<aws:Arguments>
<aws:Argument>
<aws:Name>url</aws:Name>
<aws:Value>www.instagram.com</aws:Value>
</aws:Argument>
<aws:Argument>
<aws:Name>responsegroup</aws:Name>
<aws:Value>Categories</aws:Value>
</aws:Argument>
</aws:Arguments>
</aws:Request>
<aws:Related>
<aws:DataUrl type="canonical">instagram.com/</aws:DataUrl>
</aws:Related>
</aws:Alexa>
</aws:UrlInfoResult>
<aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
<aws:StatusCode>Success</aws:StatusCode>
</aws:ResponseStatus>
</aws:Response>
</aws:UrlInfoResponse>
Evening,
I'm trying to use the traffic history response group but I'm unable to add in the range and start parameters successfully. When I just run the query it returns successfully with the default values, I've tried a few combinations but I can't seem to get it to come together.
I'm also struggling to parse the response, I am receiving a successful response but I follow the example of URLInfo at the top of the README doc I encounter some issues.
When I make a request, I get a "request has expired" error. Any suggestions?
bs4 and requests are missing. Giving that the module only runs when these are present, maybe better to include it to setup.py. If you like I can make a PR with this change.
Following the example code on the README.md and using the git master, I'm getting the below error message.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-3-9304a8f0e37b> in <module>()
----> 1 pprint.pprint(flatten_urlinfo(urlinfo))
/Users/mikko/dev/norway/lib/python2.7/site-packages/myawis/__init__.pyc in flatten_urlinfo(urlinfo, shorter_keys)
161 _result = {}
162 info = xmltodict.parse(str(urlinfo))
--> 163 flatten(info["aws:UrlInfoResponse"]["Response"]["UrlInfoResult"]["Alexa"])
164 _result["OutputTimestamp"] = create_timestamp()
165 return _result
KeyError: 'Response'
I loved this module, but it no longer works as only V4 signing works now.
Is it possible for someone to update this to V4 signing? Thanks so much!
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.
I'm getting this error when running my python script:
NameError: name 'Access_Key_ID' is not defined
P.S: I have removed my real access key from the above code.
Hey guys, I think the latest version on pypi is 0.2.3, can you update it to 0.2.4 there? Thanks.
For some domains like yahoo.com and amazon.com I'm getting the following error:
Traceback (most recent call last):
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 134, in flatten
items = value.items()
AttributeError: 'list' object has no attribute 'items'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 270, in process_update
handler.handle_update(update, self)
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/telegram/ext/messagehandler.py", line 169, in handle_update
return self.callback(dispatcher.bot, update, **optional_args)
File "rankcheckbot.py", line 101, in instantrank
data = flatten_urlinfo(urlinfo)
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 163, in flatten_urlinfo
flatten(info["aws:UrlInfoResponse"]["Response"]["UrlInfoResult"]["Alexa"])
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 159, in flatten
flatten(v, ".".join([prefix, k]))
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 159, in flatten
flatten(v, ".".join([prefix, k]))
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 159, in flatten
flatten(v, ".".join([prefix, k]))
File "/Users/mostafalameei/Sites/rankcheckbot/lib/python3.6/site-packages/myawis/__init__.py", line 156, in flatten
raise NotImplementedError(msg)
NotImplementedError: .OwnedDomain contains a list we don't know how to flatten.
Is it possible to get the sites linking in from this wrapper?
Following the instructions provided in the README.md, I get the error on flatten_urlinfo():
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-9304a8f0e37b> in <module>()
----> 1 pprint.pprint(flatten_urlinfo(urlinfo))
NameError: name 'flatten_urlinfo' is not defined
I tried the basic example in the home page but I get a KeyError with flatten_urlinfo :
from myawis import *
obj = CallAwis(Access_Key_ID, Secret_Access_Key)
urlinfo = obj.urlinfo("www.example.com")
b = flatten_urlinfo(urlinfo)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "...eb-virt\lib\site-packages\myawis\__init__.py", line 194, in flatten_urlinfo
flatten(info["aws:UrlInfoResponse"]["Response"]["UrlInfoResult"]["Alexa"])
KeyError: 'Response'
Hello, I installed form pip and am doing:
from myawis import *
access = 'x'
secret = 'x'
obj = CallAwis(access, secret)
urlinfo = obj.urlinfo("www.example.com")
and I get:
{'OutputTimestamp': '20180520T152730Z',
'Request.Errors.Error.ErrorCode': '"User: '
'arn:aws:iam::192208424764:user/alexa is '
'not authorized to perform: awis:GET on '
'resource: '
'arn:aws:awis:us-west-1:192208424764:/api"'}
But this credential is ok in the AWS side. Any ideas?
obj=CallAwis('www.dealsea.com','Rank', 'my id', 'my key')
obj.urlinfo()
Returns:
\nRequestExpired
Request has expired. Timestamp date is 2017-08-31T00:41:56.381165e6ee50f7-5ca7-a1f4-2866-8a34076f48e6A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.