[Python] AttributeError: 'WSGIRequest' object has no attribute 'get' while making a get request

Discussão em 'Python' iniciado por Stack, Junho 14, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a get request to stackoverflow API but I am facing a WSGI error while making the requests through POSTMAN. Here is the code snippet:

    Views:

    def search(requests):
    query = requests.GET["query"]
    response = requests.get('https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=activity&q=' + query + '&site=stackoverflow')
    api_Data = response.json()
    return JsonResponse({"message": api_Data})


    URLs:

    urlpatterns = [
    path('search/', views.search, name='search'),
    ]


    I have tried I keep getting 'WSGIRequest' object has no attribute 'Get' on django but it did not work.

    Continue reading...

Compartilhe esta Página