'HttpRequest' object has no attribute 'META'

I am trying to search api data through a search bar then render it to another template and I keep getting this error. I am not sure how to fix it. I have done some research and looked at the docs but haven’t been able to correct the issue. I am still new to coding and to Django so any help would be appreciated. Here is my api call


def search_results(request):
    searched = request.GET.get('searched', '')  
    if searched:
        # Perform the search
        key = config('API_KEY')
        youtube = build('youtube', 'v3', developerKey=key)
        request = youtube.search().list(
            part="snippet",
            maxResults=5,
            q=searched,
            order="date",
            type='video'
        )

        results = request.execute()

        print(results)
        return render(request, 'search/results.html', {'results': results})
    else:
        return render(request, 'search/results.html', {'results': {}})
    ```
Here is my template I want to render data to

{% extends ‘base.html’ %}

{% block content %}

{% for key, value in results.items %}

  • {{key}}: {{value}}, {{results.key}}
  • {% endfor %}

    {% endblock %}

    My API Data structure
    ![Screenshot 2023-06-10 at 22.59.30|690x328](upload://hyYVtdmPsUZ4wJpQeSLBUXHs36l.png)

    Here is my search form

    You are reassigning the value of request that is being passed into your view as the parameter.

    You want to use a different variable name here.

    Thank you so much that worked!