Search code examples
djangodjango-viewswebhookssuperfeedr

Unable to receive RSS updates to my webhook setup using Django. Replay option sends empty POST and GET data


I am trying to setup webhooks for Django and use Superfeedr.com to receive webhooks. I am using the RSS feed link they provide for testing: http://push-pub.appspot.com/. You can update the website in realtime to test your webhook.

When I update the website I don't receive anything from my webhook. From the main subscriptions page on Superfeedr, when I click on replay for that rss feed, I receive empty POST and GET request to the webhook. How can I configure my webhook correctly so that I receive the updated RSS feed?

Here is my views:

@csrf_exempt
@require_http_methods(["GET", "POST", ])
def daily_mtg_hook(request):

    print(request.GET)
    print(request.POST)
    challenge = request.GET.get("hub.challenge")
    topic = request.GET.get("hub.topic")

    return HttpResponse(challenge)

and I used the following options to subscribe:

    def create_feed(topic):
        data = {
            'hub.mode': 'subscribe',
            'hub.topic': topic,
            'lang': 'en',
            'hub.callback': 'MY_CALLBACK_LINK',
            'hub.secret': 'SECRET',
            'hub.verify': 'sync',
            'format': 'json'
        }

        response = requests.post('https://push.superfeedr.com/', data=data, auth=('USERNAME', 'KEY'))

        print(response)


create_feed("http://push-pub.appspot.com/")

Solution

  • I am the creator of Superfeedr! I think you are get stumbling into the number 1 chanllenge: parsing the HTTP body.

    Please read this post which explains more https://blog.superfeedr.com/http-raw-body/