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

problem in django #161

Closed
aliraza7926 opened this issue Feb 27, 2021 · 0 comments
Closed

problem in django #161

aliraza7926 opened this issue Feb 27, 2021 · 0 comments

Comments

@aliraza7926
Copy link

I write a simple webhook in Django
my simple code in Django was

# this is my view.py
from django.http import HttpResponse
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
@require_POST
def test(request):
    body = request.body
    print(body)    
    return HttpResponse(status=200)

then in my terminal, I run

smee -u https://smee.io/YjVfdzh3EplhFGvv -t http://127.0.0.1:8000/webhook/

the problem is Django can not receive the body of the request
then when I press ctrl + c and stop smee then Django receive the body of the request and print it
I think my code has a problem so I send data from my local machine to the Django server
I try this and everything works fine

curl -d @test.json -H "Content-Type: application/json" -X POST http://127.0.0.1:8000/webhook/

then I search for another package and I find this

https://github.com/Akrog/pysmee

and it works fine and I could receive all data in my Django program from smee.io

I use:
python 3.9.1
Django 3.1.7
npm 7.5.3
smee 1.2.2

@Uzlopak Uzlopak closed this as completed Nov 17, 2023
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

No branches or pull requests

2 participants