Converting requests

53 views
Skip to first unread message

Suraj Thapa FC

unread,
Nov 8, 2019, 2:27:33 AM11/8/19
to django...@googlegroups.com
How do I convert the requests into render or redirect....

response = requests.post(url,data=post_data, headers={"Content-type" :"application/json" }).json()

Kasper Laudrup

unread,
Nov 8, 2019, 3:57:41 AM11/8/19
to django...@googlegroups.com
Hi Suraj,
You question doesn't make much sense since you don't write what you want
to achieve. A bit more context would be helpful.

Converting a JSON payload to an HTTP redirect is of course complete
nonsense.

Anyway, this might be helpful:

https://docs.djangoproject.com/en/2.2/ref/request-response/#jsonresponse-objects

Kind regards,

Kasper Laudrup

> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcE2WvU5qmss37TsiiraHKAP9YG_n5%2BEJbSYAQiRsW7EDQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjsHcE2WvU5qmss37TsiiraHKAP9YG_n5%2BEJbSYAQiRsW7EDQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Suraj Thapa FC

unread,
Nov 8, 2019, 6:07:11 AM11/8/19
to django...@googlegroups.com
Actually i want to made a post request to the url with post_data

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea999299-5d21-ce7b-4426-e7ce4581de36%40stacktrace.dk.

Kasper Laudrup

unread,
Nov 8, 2019, 6:32:55 AM11/8/19
to django...@googlegroups.com
Hi Suraj,

On 08/11/2019 12.06, Suraj Thapa FC wrote:
> Actually i want to made a post request to the url with post_data
>

OK, so you want to do something completely different than what you wrote
originally?

Thankfully, the line of code you shared does exactly that assuming you
are using the requests library, but of course we can only guess since
you don't seem very willing to share information.

How is this related to Django btw.?

Kind regards,

Kasper Laudrup

Suraj Thapa FC

unread,
Nov 8, 2019, 7:20:59 AM11/8/19
to django...@googlegroups.com
I'm integrating the payment gateway in a website... They provided the documentation in python...

All I have to do is make a post request to that url with the given data... 

--
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.

Kasper Laudrup

unread,
Nov 8, 2019, 7:29:38 AM11/8/19
to django...@googlegroups.com
Hi Suraj,

On 08/11/2019 13.19, Suraj Thapa FC wrote:
> I'm integrating the payment gateway in a website... They provided the
> documentation in python...
>
> All I have to do is make a post request to that url with the given data...
>

Do you have any questions or do you just feel like sharing what you
currently work on?

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages