Skip to content

Instantly share code, notes, and snippets.

@aamishbaloch
Created September 26, 2017 12:11
Show Gist options
  • Save aamishbaloch/cfe2f8755241687c928e426c64644278 to your computer and use it in GitHub Desktop.
Save aamishbaloch/cfe2f8755241687c928e426c64644278 to your computer and use it in GitHub Desktop.
Creating http request object a setting Params in Django

Creating http request object a setting Params in Django

Whenever we have to call an external link(URL) and get any sort of data from that, we might came across the need to create a http request object and setting up some params for that. So following is the example for doing that in Django.

from django.http import HttpRequest

request = HttpRequest()

request.method = 'GET'
request.user = user
request.GET.update({"thread_id": thread.id})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment