Skip to content

Add subaccount support #150

Open
Open

Description

@cisarpavel

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

Thanks

Pavel Cisar

Activity

  1. richleland commented on May 23, 2017

    @richleland
    Contributor

    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?

  2. self-assigned this
    on May 23, 2017
  3. cisarpavel commented on May 24, 2017

    @cisarpavel
    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.

  4. richleland commented on May 24, 2017

    @richleland
    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.

  5. nickperkins commented on Jul 17, 2019

    @nickperkins

    @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions