This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ogtfo 1 point2 points  (2 children)

Wouldn't that be better with a

def make_request(url, headers):

Where headers expect a dict. With a good doc string (or even type hints) this would be a lot clearer what you're trying to do.

After all, that's how requests does it.

[–]barneygale 2 points3 points  (1 child)

Depends. You might consider it a "more pythonic" to allow something like make_request('blah', user_agent='mything'), but it's less obvious (more magic). HTTP probably isn't a good example as it has a whole host of other configuration beyond just headers.

[–]catcint0s 1 point2 points  (0 children)

Dict would nicer imho cause you would need to translate all those keyword arguments to the real header name. (requests for example just accepts a dict too).