You want to use request.args for your GET parameters in Flask. Here is a quote with an example from the Accessing Request Data section of the Quickstart document.


To access parameters submitted in the URL (?key=value) you can use the args attribute:

searchword = request.args.get('key', '')    
Answer from istruble on Stack Overflow
🌐
PythonAnywhere
pythonanywhere.com › forums › topic › 4603
AttributeError: 'Request' object has no attribute 'get_data' : Forums : PythonAnywhere
May 25, 2016 - from flask import Flask, request import hmac import hashlib import subprocess app = Flask(__name__) @app.route("/github-update", methods=["POST"]) def github_update(): h = hmac.new(CONFIG_GITHUB_WEBOOK_SECRET, request.get_data(), hashlib.sha1) if h.hexdigest() != request.headers.get("X-Hub-Signature", "")[5:]: # A timing attack here is nearly impossible. return "FAIL" try: subprocess.Popen("git pull", shell=True).wait() except OSError: return "ERROR" return "OK" ... EDIT: It worked over here too~ https://github.com/BronyTV/bronytv.net/blob/master/btv_site/app.py#L30 · deleted-user-1101648 | 89 posts | May 25, 2016, 9:42 p.m. | permalink · Fixed. Instead of "request.get_data()", it is "request.data()".
Discussions

python - AttributeError: 'Request' object has no attribute 'get' - Stack Overflow
When i make a POST request to my server, i get a 500 ERROR with comment: AttributeError: 'Request' object has no attribute 'get' This is my server: @app.route('/api/entries', methods = ['POST'])... More on stackoverflow.com
🌐 stackoverflow.com
python - 'Request' object has no attribute 'get' error while getting the api url - Stack Overflow
In this when I got to the validat_phone URL and I post the phone_number in URL, it returns the error 'Request' object has no attribute 'get', I don't know how to fix the error. Is there is a way t... More on stackoverflow.com
🌐 stackoverflow.com
python - Request' object has no attribute 'get': Django Views &. Serializers - Stack Overflow
I am working on a Dajngo DRF app serving as the API for my app. I am really struggling to debug this error: Request object has no attribute 'get'. The error pops up after I update my organisation. ... More on stackoverflow.com
🌐 stackoverflow.com
February 3, 2023
Please How Can I fix "AttributeError at /items/ 'WSGIRequest' object has no attribute 'Get'"
I am still working on the tutorial from Code with Stein. video timestamp 1:51:39. When I save my code and open my browser I get this error message File "C:\Users\hp\Documents\Learn Python\Django\Code with Stein\Puddle… More on forum.djangoproject.com
🌐 forum.djangoproject.com
1
0
September 13, 2024
🌐
GitHub
github.com › graphql-python › graphene-sqlalchemy › issues › 130
I keep getting a request error: 'Request' object has no attribute 'get' · Issue #130 · graphql-python/graphene-sqlalchemy
May 1, 2018 - An error occurred while resolving field Query.materiais Traceback (most recent call last): File "/home/jhon/.local/share/virtualenvs/crm_api-CGOvMSyN/lib/python3.5/site-packages/graphql/execution/executor.py", line 311, in resolve_or_error return executor.execute(resolve_fn, source, info, **args) File "/home/jhon/.local/share/virtualenvs/crm_api-CGOvMSyN/lib/python3.5/site-packages/graphql/execution/executors/sync.py", line 7, in execute return fn(*args, **kwargs) File "/home/jhon/.local/share/virtualenvs/crm_api-CGOvMSyN/lib/python3.5/site-packages/graphene_sqlalchemy/fields.py", line 36, in
Author   jhonatanTeixeira
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-module-requests-has-no-attribute-get
Module 'requests' has no attribute 'get' or 'post' [Fixed] | bobbyhadz
April 8, 2024 - If you try to import the requests module in a file called requests.py, you would get a little different error message that means the same thing. ... Copied!import requests print(dir(requests)) def make_request(): # ⛔️ AttributeError: partially initialized module 'requests' has no attribute 'get' (most likely due to a circular import) res = requests.get('https://reqres.in/api/users') parsed = res.json() print(parsed) make_request()
🌐
Stack Overflow
stackoverflow.com › questions › 75339830 › request-object-has-no-attribute-get-django-views-serializers
python - Request' object has no attribute 'get': Django Views &. Serializers - Stack Overflow
February 3, 2023 - It snuck in there because I have ... my client ... The answer was quite simple. When initialising the serializer to a variable, the request object needs to be passed in correctly, as demonstrated below....
Find elsewhere
🌐
Reddit
reddit.com › r/django › 'application' object has no attribute 'request'
r/django on Reddit: 'Application' object has no attribute 'request'
October 6, 2021 -

I have this idea to put a confirm/deny in list_page so that when I click confirm it automatically sends an email to the user that he or she is approved. I have put a confirm/deny in list_page successfully, but it gives me an attribute error when I click confirm. Can someone help me what's wrong with my code?

this is my views

@admin.register(Application)
class ApplicationAdmin(admin.ModelAdmin):
    list_display = ['user', 'confirmed', 'denied']

    def confirmed(self, obj):
        url = reverse('admin:confirm_url', kwargs={'id': obj.id})
        return format_html('<a class="button" href="{}">Confirm</a>', url)

    def denied(self, obj):
        url = reverse('admin:denied_url', kwargs={'id': obj.id})
        return format_html('<a class="button" href="{}">Deny</a>', url)

    def get_urls(self):
        urls = super().get_urls()
        custom_urls = [
            path('confirm/<int:id>', self.confirmed_application, name='confirm_url'),
            path('deny/<int:id>', self.denied_application, name='denied_url'),
        ]
        return custom_urls + urls

    def confirmed_application(self, request, id):
        # you get object_id you can do whatever you want
        # you can send a mail
        self.object = self.get_object(request, id)
        subject = 'Approved'
        message = f'Your application has been approved.'
        email_from = settings.EMAIL_HOST_USER
        recipient_list = [self.request.user.email]
        send_mail(subject, message, email_from, recipient_list)

        # after processed all logic you can redirect same modeladmin changelist page
        redirect_url = "admin:{}_{}_changelist".format(self.opts.app_label, self.opts.model_name)
        return redirect(reverse(redirect_url))

    def denied_application(self, request, id):
        # same as  confirmed_application
        self.object = self.get_object(request, id)
        subject = 'Rejected'
        message = f'Your application has been denied.'
        email_from = settings.EMAIL_HOST_USER
        recipient_list = [self.request.user.email]
        send_mail(subject, message, email_from, recipient_list)

        redirect_url = "admin:{}_{}_changelist".format(self.opts.app_label, self.opts.model_name)
        return redirect(reverse(redirect_url))
🌐
GitHub
github.com › pallets › werkzeug › issues › 1622
AttributeError: 'Request' object has no attribute 'get__json' · Issue #1622 · pallets/werkzeug
August 3, 2019 - Trying to post to an endpoint using postman, but after posting i keeping getting that attribute error with the use "get__json()" Below is my method @app.route('/store', methods=["POST"]) def create_store(): request_data = request.get__js...
🌐
Django Forum
forum.djangoproject.com › using django
WSGIRequest' object has no attribute 'get' error after submitting - Using Django - Django Forum
September 23, 2021 - Traceback (most recent call last): File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\core\handlers\exception.py", line 47, in inner response = get_response(request) File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\core\ha...
Top answer
1 of 12
42

This is the typical symptom of an unrelated requests.py (or requests.pyc) file sitting in your current directory, or somewhere else on the PYTHONPATH. If this is the case, remove or rename it, as it's shadowing the module you really want to import.

2 of 12
20

You are importing all names from the requests module into your local namespace, which means you do not need to prefix them anymore with the module name:

>>> from requests import *
>>> get
<function get at 0x107820b18>

If you were to import the module with an import requests statement instead, you added the module itself to your namespace and you do have to use the full name:

>>> import requests
>>> requests.get
<function get at 0x102e46b18>

Note that the above examples is what I got from my tests in the interpreter. If you get different results, you are importing the wrong module; check if you have an extra requests.py file in your python package:

>>> import requests
>>> print requests.__file__
/private/tmp/requeststest/lib/python2.7/site-packages/requests/__init__.pyc

You can also test for the name listing provided by the requests module:

>>> print dir(requests)
['ConnectionError', 'HTTPError', 'Request', 'RequestException', 'Response', 'Session', 'Timeout', 'TooManyRedirects', 'URLRequired', '__author__', '__build__', '__builtins__', '__copyright__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__path__', '__title__', '__version__', '_oauth', 'api', 'auth', 'certs', 'codes', 'compat', 'cookies', 'defaults', 'delete', 'exceptions', 'get', 'head', 'hooks', 'models', 'options', 'packages', 'patch', 'post', 'put', 'request', 'safe_mode', 'session', 'sessions', 'status_codes', 'structures', 'utils']
🌐
Reddit
reddit.com › r/learnpython › keep getting "attributeerror: 'module' has no attribute 'get'?
r/learnpython on Reddit: Keep getting "AttributeError: 'module' has no attribute 'get'?
August 8, 2016 -

I'm very new to Python, and am practicing using the Requests library. However, whenever I run this:

import requests
r=requests.get("https://automatetheboringstuff.com/files/rj.txt")
print(len(r.text))

I am given the message:

AttributeError: 'module' object has no attribute 'get'

I'm using Python 3 in Canopy.

I've spent a while googling, but none of the solutions that others have suggested worked. I can't find any other .py file on my computer that is named 'Requests', for instance. When I run:

print(dir(requests))

I get:

['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'binary', 'do_not']

Can anyone help? Thanks in advance!

🌐
Render
community.render.com › t › attributeerror-module-requests-has-no-attribute-get › 19360
AttributeError: module 'requests' has no attribute 'get' - Render
February 23, 2024 - I successfully deployed a FastAPI webservice (tiangolo/fastapi on github.com). I tried to extend the function of my API but I soon get stuck. I thought I have some small storage space in free plan so I plan to store some small files for my API to process. However, it complains about my requests.get call.
🌐
Sololearn
sololearn.com › en › Discuss › 2066141 › attributeerror-function-object-has-no-attribute-get-flask-python
AttributeError: 'function' object has no attribute 'get' - Flask Python | Sololearn: Learn to code for FREE!
November 11, 2019 - It looks to me like you are overwriting the posts dictionary when defining the posts function (the error is a giveaway for that) Try renaming the function to something else: def get_post(post_id): .....
🌐
Odoo
odoo.com › forum › help-1 › attributeerror-request-object-has-no-attribute-app-208273
AttributeError: 'Request' object has no attribute 'app' - - - | Odoo
August 12, 2022 - I am getting this error while try to access any existing database. It was working fine but the error exists just yesterday.
🌐
Reddit
reddit.com › r/django › attributeerror at /post/ 'post' object has no attribute 'get'
r/django on Reddit: AttributeError at /Post/ 'Post' object has no attribute 'get'
February 1, 2021 -

Hi. I have this problem "AttributeError at /Post/ 'Post' object has no attribute 'get'"

and have no clue why it happens. I am using a django filter and it's my first time trying "foreignkey"

There are two simple models and Post_price is the one that has a foreignkey attribute.

Thank you for your help in advance.

<These are the models.py files>

class Post(models.Model):

name= models.CharField(max_length=11,default='')

class Post_price(models.Model):

post= models.ForeignKey('Post', blank=True, null=True, on_delete=models.SET_NULL)

content= models.IntegerField(default='')

<it's a django filter file>

class PostFilter(django_filters.FilterSet):

class Meta:

model = Post

fields = {

'name': ...(I just handled it well)

<This one is for views.py>

def Post(request):

s = Post.objects.all()

aq = PostFilter(request.GET, queryset=s)

return render(request,'app/Post.html',{'s':aq})

<just in case urls.py's path part>

path('Post/',Post,name='Post'),