Wednesday, August 1, 2018

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

On Wed, 2018-08-01 at 00:26 -0700, imran@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.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/1533108947.1719.1.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment