How to write api for sms intregartion in django I am new in django?

13 views
Skip to first unread message

im...@wsegames.com

unread,
Aug 1, 2018, 3:15:28 AM8/1/18
to Django users
I want to write a api when form submit a sms should go to the phone, I don't know how to do that can somone help me regarding this?

Tim Vogt (Tim Vogt)

unread,
Aug 1, 2018, 3:17:55 AM8/1/18
to django...@googlegroups.com
Op 1 aug. 2018, om 09:15 heeft im...@wsegames.com het volgende geschreven:

I want to write a api when form submit a sms should go to the phone, I don't know how to do that can somone help me regarding this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/253c999f-2151-4b42-8bd9-f7288f57c394%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

im...@wsegames.com

unread,
Aug 1, 2018, 3:22:41 AM8/1/18
to Django users
I want to write api how to write can you help me?

im...@wsegames.com

unread,
Aug 1, 2018, 3:26:12 AM8/1/18
to Django users
Here is my code


class RegisterView(CreateView):
form_class = RegisterForm
template_name = 'accounts/register.html'
success_url = '/success-membership/'

def form_valid(self, form):
url = "http://enterprise.smsgupshup.com/GatewayAPI/rest"
payload = "method=sendMessage&send_to=XXXXXXXXXX&msg=new&msg_type=TEXT&userid=XXXXX&auth_scheme=PLAIN&password=XXXXX&format=TEXT"
response = requests.request("POST", url, data=payload)
print(response.text)
return HttpResponse(response)

On Wednesday, August 1, 2018 at 12:47:55 PM UTC+5:30, Tim Vogt wrote:

Mark Caglienzi

unread,
Aug 1, 2018, 3:36:12 AM8/1/18
to django...@googlegroups.com
On Wed, 2018-08-01 at 00:26 -0700, im...@wsegames.com wrote:
> Here is my code
>
>
> class RegisterView(CreateView):
>     form_class = RegisterForm
>     template_name = 'accounts/register.html'
>     success_url = '/success-membership/'
>
>     def form_valid(self, form):
>         url = "http://enterprise.smsgupshup.com/GatewayAPI/rest"
>         payload = "method=sendMessage&send_to=XXXXXXXXXX&msg=new&msg_type=TEXT&userid=XXXXX&auth_scheme=PLAIN&password=XXXXX&format=TEXT"
>         response = requests.request("POST", url, data=payload)
>         print(response.text)
>         return HttpResponse(response)

Well, apart from everything, making a request with user and password in the clear
it's not a good idea at all.

im...@wsegames.com

unread,
Aug 1, 2018, 3:39:30 AM8/1/18
to Django users
I just want to test other wise I can load the data dynamically
Reply all
Reply to author
Forward
0 new messages