2017-11-05 19:46:43 -05:00
|
|
|
import requests
|
|
|
|
from django.conf import settings
|
2017-11-05 19:04:22 -05:00
|
|
|
from django_rq import job
|
2017-11-06 05:08:02 -05:00
|
|
|
from ronkyuu import webmention
|
2017-11-05 19:04:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
@job
|
|
|
|
def ping_hub(*urls):
|
2017-11-06 05:05:00 -05:00
|
|
|
data = [('hub.mode', 'publish')] + [('hub.url[]', url) for url in urls]
|
|
|
|
requests.post(settings.PUSH_HUB, data=data)
|
2017-11-06 05:08:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
@job
|
|
|
|
def send_mentions(url):
|
|
|
|
result = webmention.findMentions(url)
|
|
|
|
for target in result['refs']:
|
|
|
|
webmention.sendWebmention(url, target)
|