mosquito / aiohttp-xmlrpc

XMLRPC for aiohttp
MIT License
34 stars 19 forks source link

Custom User Agent #8

Closed Diaoul closed 7 years ago

Diaoul commented 7 years ago

Although it's nice that the ServerProxy comes with its predefined UserAgent, I'd need to use my own. Could you please make it so it is an argument to __init__?

mosquito commented 7 years ago

Are you sure that you want to pass it into __init__? I thought if someone will want to change it, the simple solution it is the inheriting.

class MyServerProxy(ServerProxy):
    USER_AGENT="My User Agent"
Diaoul commented 7 years ago

Both are ok, I mainly wanted to avoid subclassing just for this. Even if I provide my own ClientSession with its own useragent it would be overridden.

Diaoul commented 7 years ago

Actually I could use the kwargs to pass arguments from the ServerProxy to the ClientSession with headers but that would be overridden as well.

So what I would expect from the ServerProxy (let me know if you agree):

This has the advantage of not needing any extra arguments.

mosquito commented 7 years ago

I already added the headers argument for the ServerProxy in 0.6.0. Please reopen this issue when that's not enough for you.