One function

Request in oauthlib/oauthlib

The author described this change as #340 - raise AttributeError from common.Request.__getattr__+ add tests. It counts as a record because the check below fails on the code as it stood at 514cad74b and passes on 539558a02, with nothing else changed between the two runs.

Fix saved2015-05-09
Sharing licenceBSD-3-Clause · LICENSE
Change size+4 1

What the code was meant to do, written into the code itself as a docstring

A malleable representation of a signable HTTP request. Body argument may contain any data, but parameters will only be decoded if they are one of: * urlencoded query string * dict * list of 2-tuples Anything else will be treated as raw body data to be passed through unmolested.

The change

3131 self._params.update(self.headers)
3232
3333 def __getattr__(self, name):
34- return self._params.get(name, None)
34+ if name in self._params:
35+ return self._params[name]
36+ else:
37+ raise AttributeError(name)
3538
3639 def __repr__(self):
3740 return '<oauthlib.Request url="%s", http_method="%s", headers="%s", body="%s">' % (

The check that tells the two apart

failpass·tests/test_common.py::RequestTest::test_getattr_raise_attribute_error

Check file tests/test_common.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it514cad74bde4cd7781b496155058a79507245798
Broken version dated2015-04-19
Moduleoauthlib.common
Units changedRequest
Fingerprintfd897c622c0dccd2
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.