Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subaccount support #150

Open
cisarpavel opened this issue May 19, 2017 · 4 comments
Open

Add subaccount support #150

cisarpavel opened this issue May 19, 2017 · 4 comments

Comments

@cisarpavel
Copy link

Master account can pretend be subaccount using extra header. This feature is not implemented or I did not find it.

Thanks

Pavel Cisar

@richleland
Copy link
Contributor

richleland commented May 23, 2017

Right you are. I'd like to better understand the way you use the library so we can implement this properly. I see a couple of ways subaccounts could be used:

  • During instantiation of the SparkPost class - setting subaccount there would make it cascade down through every call:
from sparkpost import SparkPost

sp = SparkPost(subaccount=123)

response = sp.transmissions.send(
    ...
)
  • During each request - for example sp.transmissions.send:
from sparkpost import SparkPost

sp = SparkPost()

response = sp.transmissions.send(
    subaccount=123,
    ...
)

Any thoughts on which approach would best suit your use case? Is instantiating multiple instances of SparkPost, one per subaccount, something that could work, or do we need more granular control?

@richleland richleland self-assigned this May 23, 2017
@cisarpavel
Copy link
Author

Hi,
for me would be better usage the second one. Specify account for each transmission.
In fact, the the first way can be done already. It's not exactly like defining subaccount for master account while init, but I can create two instances with API KEYs related only to subaccounts. That should give me chance to transmit like subaccounts I think, but it seems to me quite ugly way.
The second way seems to me more flexible.

Thanks for your help.

@richleland
Copy link
Contributor

Yeah all good points - thanks for the feedback @cisarpavel. I'm going to extract this in the base resource's request method and then pass through **kwargs to any calls to the self.request from the subclasses.

@nickperkins
Copy link

@jgzamora Preeeety sure this can be closed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants