- Why am I able to call to and return variable (HTTP request) properties from this function without passing a parameter first?
- How does the f in f"abc123" work?
import requests
def oauth(r):
r.headers["Authorization"] = f"abc123"
r.headers["User-Agent"] = "v2TweetLookupPython"
return r
my_json = requests.request("GET", url, auth=oauth).json()
The call to the oauth function in auth=oauth is successful, without having to pass its parameter, r. With the requests module, is the single character 'r' an implicit reference to a requests object?