Pardon my Python skill or the lack of it. I saw some methods calls of the form
auth_req = urllib2.Request(auth_uri, data=authreq_data)
If I put in just authreq_data I get an error. What is the correct technical definition for this type of method argument? Is it a boolean/predicate type?
They're called keyword arguments.
You can use them without specifying the keyword, so long as you also pass all the arguments before them.
The signature of urrlib2.Request is
urllib2.Request(url[, data][, headers][, origin_req_host][, unverifiable])
So as long as you specify the url, auth_uri in this case, you should be able to pass authreq_data without specifying that it is the data argument.
auth_req = urllib2.Request(auth_uri, authreq_data)
Python 3 has also added a syntax for specifying keyword only arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With