Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1594 Alexa webhook for priority label #1615

Merged
merged 2 commits into from
Sep 8, 2017

Conversation

MDTsai
Copy link
Contributor

@MDTsai MDTsai commented Jun 23, 2017

Addd alexa topsite DB
Find priority label for domain name or less-level domain in DB

@MDTsai MDTsai force-pushed the Issue_1594 branch 4 times, most recently from 32c1965 to e9a54d6 Compare June 28, 2017 19:51
@MDTsai
Copy link
Contributor Author

MDTsai commented Jun 28, 2017

r? = @karlcow

Copy link
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MDTsai a couple of changes here and there. Hope it helps.

"""Extract priority label."""
with patch('webcompat.db.site_db.query') as db_mock:
db_mock.return_value.filter_by.return_value =
[Site('google.com', 1, '', 1)]

This comment was marked as abuse.

from webcompat import app
from webcompat.db import Site
from webcompat.webhooks import helpers

# Add webcompat module to import path

This comment was marked as abuse.

@@ -9,6 +9,7 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy import Integer
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from hashlib import sha512

This comment was marked as abuse.

This comment was marked as abuse.

site_db = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=site_engine))


class WCIssue(IssueBase):

This comment was marked as abuse.

@@ -78,3 +82,25 @@ def get_payload_signature(key, payload):
'''Compute the payload signature given a key.'''
mac = hmac.new(key, msg=payload, digestmod=hashlib.sha1)
return mac.hexdigest()


def extract_priority_label(body):

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

for i in list(reversed(range(2, len(domains)))):
shorten_domain_name = '.'.join(domains[(len(domains)-i):])
for site in site_db.query(Site).filter_by(url=shorten_domain_name):
return 'priority-{}'.format(priorities[site.priority-1])

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

Addd alexa topsite DB
Find priority label for domain name or less-level domain in DB
@miketaylr
Copy link
Member

Adding do not merge label until we have Alexa API credentials in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants