index
int64 0
731k
| package
stringlengths 2
98
⌀ | name
stringlengths 1
76
| docstring
stringlengths 0
281k
⌀ | code
stringlengths 4
1.07M
⌀ | signature
stringlengths 2
42.8k
⌀ |
---|---|---|---|---|---|
68,875 |
triad.utils.threading
|
run_once
|
The decorator to run `func` once, the uniqueness is defined by `key_func`.
This implementation is serialization safe and thread safe.
:param func: the function to run only once with this wrapper instance
:param key_func: the unique key determined by arguments of `func`, if not set, it
will use the same hasing logic as :external+python:func:`functools.lru_cache`
:param lock_type: lock class type for thread safe, it doesn't need to be
serialization safe
.. admonition:: Examples
.. code-block:: python
@run_once
def r(a):
return max(a)
a1 = [0, 1]
a2 = [0, 2]
assert 1 == r(a1) # will trigger r
assert 1 == r(a1) # will get the result from cache
assert 2 == r(a2) # will trigger r again because of different arguments
# the following example ignores arguments
@run_once(key_func=lambda *args, **kwargs: True)
def r2(a):
return max(a)
assert 1 == r(a1) # will trigger r
assert 1 == r(a2) # will get the result from cache
.. note::
* Hash collision is the concern of the user, not this class, your
`key_func` should avoid any potential collision
* `func` can have no return
* For concurrent calls of this wrapper, only one will trigger `func` other
calls will be blocked until the first call returns an result
* This class is cloudpicklable, but unpickled instance does NOT share the same
context with the original one
* This is not to replace :external+python:func:`functools.lru_cache`,
it is not supposed to cache a lot of items
|
def run_once(
func: Optional[Callable] = None,
key_func: Optional[Callable] = None,
lock_type: Type = RLock,
) -> Callable:
"""The decorator to run `func` once, the uniqueness is defined by `key_func`.
This implementation is serialization safe and thread safe.
:param func: the function to run only once with this wrapper instance
:param key_func: the unique key determined by arguments of `func`, if not set, it
will use the same hasing logic as :external+python:func:`functools.lru_cache`
:param lock_type: lock class type for thread safe, it doesn't need to be
serialization safe
.. admonition:: Examples
.. code-block:: python
@run_once
def r(a):
return max(a)
a1 = [0, 1]
a2 = [0, 2]
assert 1 == r(a1) # will trigger r
assert 1 == r(a1) # will get the result from cache
assert 2 == r(a2) # will trigger r again because of different arguments
# the following example ignores arguments
@run_once(key_func=lambda *args, **kwargs: True)
def r2(a):
return max(a)
assert 1 == r(a1) # will trigger r
assert 1 == r(a2) # will get the result from cache
.. note::
* Hash collision is the concern of the user, not this class, your
`key_func` should avoid any potential collision
* `func` can have no return
* For concurrent calls of this wrapper, only one will trigger `func` other
calls will be blocked until the first call returns an result
* This class is cloudpicklable, but unpickled instance does NOT share the same
context with the original one
* This is not to replace :external+python:func:`functools.lru_cache`,
it is not supposed to cache a lot of items
"""
def _run(func: Callable) -> "RunOnce":
return wraps(func)(RunOnce(func, key_func=key_func, lock_type=lock_type))
return _run(func) if func is not None else wraps(func)(_run) # type: ignore
|
(func: Optional[Callable] = None, key_func: Optional[Callable] = None, lock_type: Type = <function RLock at 0x7fbc37bf1510>) -> Callable
|
68,876 |
triad.utils.hash
|
to_uuid
|
Determine the uuid by input arguments. It will search the input recursively.
If an object contains `__uuid__` method, it will call that method to get the uuid
for that object.
.. admonition:: Examples
.. code-block:: python
to_uuid([1,2,3])
to_uuid(1,2,3)
to_uuid(dict(a=1,b="z"))
:param args: arbitrary input
:return: uuid string
|
def to_uuid(*args: Any) -> str:
"""Determine the uuid by input arguments. It will search the input recursively.
If an object contains `__uuid__` method, it will call that method to get the uuid
for that object.
.. admonition:: Examples
.. code-block:: python
to_uuid([1,2,3])
to_uuid(1,2,3)
to_uuid(dict(a=1,b="z"))
:param args: arbitrary input
:return: uuid string
"""
s = str(uuid.uuid5(uuid.NAMESPACE_DNS, ""))
for a in args:
for x in _get_strs(a):
s = str(uuid.uuid5(uuid.NAMESPACE_DNS, s + x))
return s
|
(*args: Any) -> str
|
68,878 |
gym.core
|
ActionWrapper
|
Superclass of wrappers that can modify the action before :meth:`env.step`.
If you would like to apply a function to the action before passing it to the base environment,
you can simply inherit from :class:`ActionWrapper` and overwrite the method :meth:`action` to implement
that transformation. The transformation defined in that method must take values in the base environment’s
action space. However, its domain might differ from the original action space.
In that case, you need to specify the new action space of the wrapper by setting :attr:`self.action_space` in
the :meth:`__init__` method of your wrapper.
Let’s say you have an environment with action space of type :class:`gym.spaces.Box`, but you would only like
to use a finite subset of actions. Then, you might want to implement the following wrapper::
class DiscreteActions(gym.ActionWrapper):
def __init__(self, env, disc_to_cont):
super().__init__(env)
self.disc_to_cont = disc_to_cont
self.action_space = Discrete(len(disc_to_cont))
def action(self, act):
return self.disc_to_cont[act]
if __name__ == "__main__":
env = gym.make("LunarLanderContinuous-v2")
wrapped_env = DiscreteActions(env, [np.array([1,0]), np.array([-1,0]),
np.array([0,1]), np.array([0,-1])])
print(wrapped_env.action_space) #Discrete(4)
Among others, Gym provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
|
class ActionWrapper(Wrapper):
"""Superclass of wrappers that can modify the action before :meth:`env.step`.
If you would like to apply a function to the action before passing it to the base environment,
you can simply inherit from :class:`ActionWrapper` and overwrite the method :meth:`action` to implement
that transformation. The transformation defined in that method must take values in the base environment’s
action space. However, its domain might differ from the original action space.
In that case, you need to specify the new action space of the wrapper by setting :attr:`self.action_space` in
the :meth:`__init__` method of your wrapper.
Let’s say you have an environment with action space of type :class:`gym.spaces.Box`, but you would only like
to use a finite subset of actions. Then, you might want to implement the following wrapper::
class DiscreteActions(gym.ActionWrapper):
def __init__(self, env, disc_to_cont):
super().__init__(env)
self.disc_to_cont = disc_to_cont
self.action_space = Discrete(len(disc_to_cont))
def action(self, act):
return self.disc_to_cont[act]
if __name__ == "__main__":
env = gym.make("LunarLanderContinuous-v2")
wrapped_env = DiscreteActions(env, [np.array([1,0]), np.array([-1,0]),
np.array([0,1]), np.array([0,-1])])
print(wrapped_env.action_space) #Discrete(4)
Among others, Gym provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
"""
def step(self, action):
"""Runs the environment :meth:`env.step` using the modified ``action`` from :meth:`self.action`."""
return self.env.step(self.action(action))
def action(self, action):
"""Returns a modified action before :meth:`env.step` is called."""
raise NotImplementedError
def reverse_action(self, action):
"""Returns a reversed ``action``."""
raise NotImplementedError
|
(env: gym.core.Env)
|
68,879 |
gym.core
|
__enter__
|
Support with-statement for the environment.
|
def __enter__(self):
"""Support with-statement for the environment."""
return self
|
(self)
|
68,880 |
gym.core
|
__exit__
|
Support with-statement for the environment.
|
def __exit__(self, *args):
"""Support with-statement for the environment."""
self.close()
# propagate exception
return False
|
(self, *args)
|
68,881 |
gym.core
|
__getattr__
|
Returns an attribute with ``name``, unless ``name`` starts with an underscore.
|
def __getattr__(self, name):
"""Returns an attribute with ``name``, unless ``name`` starts with an underscore."""
if name.startswith("_"):
raise AttributeError(f"accessing private attribute '{name}' is prohibited")
return getattr(self.env, name)
|
(self, name)
|
68,882 |
gym.core
|
__init__
|
Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods.
Args:
env: The environment to wrap
|
def __init__(self, env: Env):
"""Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods.
Args:
env: The environment to wrap
"""
self.env = env
self._action_space: Optional[spaces.Space] = None
self._observation_space: Optional[spaces.Space] = None
self._reward_range: Optional[Tuple[SupportsFloat, SupportsFloat]] = None
self._metadata: Optional[dict] = None
|
(self, env: gym.core.Env)
|
68,883 |
gym.core
|
__repr__
|
Returns the string representation of the wrapper.
|
def __repr__(self):
"""Returns the string representation of the wrapper."""
return str(self)
|
(self)
|
68,884 |
gym.core
|
__str__
|
Returns the wrapper name and the unwrapped environment string.
|
def __str__(self):
"""Returns the wrapper name and the unwrapped environment string."""
return f"<{type(self).__name__}{self.env}>"
|
(self)
|
68,885 |
gym.core
|
action
|
Returns a modified action before :meth:`env.step` is called.
|
def action(self, action):
"""Returns a modified action before :meth:`env.step` is called."""
raise NotImplementedError
|
(self, action)
|
68,886 |
gym.core
|
close
|
Closes the environment.
|
def close(self):
"""Closes the environment."""
return self.env.close()
|
(self)
|
68,887 |
gym.core
|
render
|
Renders the environment.
|
def render(
self, *args, **kwargs
) -> Optional[Union[RenderFrame, List[RenderFrame]]]:
"""Renders the environment."""
return self.env.render(*args, **kwargs)
|
(self, *args, **kwargs) -> Union[~RenderFrame, List[~RenderFrame], NoneType]
|
68,888 |
gym.core
|
reset
|
Resets the environment with kwargs.
|
def reset(self, **kwargs) -> Tuple[ObsType, dict]:
"""Resets the environment with kwargs."""
return self.env.reset(**kwargs)
|
(self, **kwargs) -> Tuple[~ObsType, dict]
|
68,889 |
gym.core
|
reverse_action
|
Returns a reversed ``action``.
|
def reverse_action(self, action):
"""Returns a reversed ``action``."""
raise NotImplementedError
|
(self, action)
|
68,890 |
gym.core
|
step
|
Runs the environment :meth:`env.step` using the modified ``action`` from :meth:`self.action`.
|
def step(self, action):
"""Runs the environment :meth:`env.step` using the modified ``action`` from :meth:`self.action`."""
return self.env.step(self.action(action))
|
(self, action)
|
68,891 |
gym.core
|
Env
|
The main OpenAI Gym class.
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
An environment can be partially or fully observed.
The main API methods that users of this class need to know are:
- :meth:`step` - Takes a step in the environment using an action returning the next observation, reward,
if the environment terminated and observation information.
- :meth:`reset` - Resets the environment to an initial state, returning the initial observation and observation information.
- :meth:`render` - Renders the environment observation with modes depending on the output
- :meth:`close` - Closes the environment, important for rendering where pygame is imported
And set the following attributes:
- :attr:`action_space` - The Space object corresponding to valid actions
- :attr:`observation_space` - The Space object corresponding to valid observations
- :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards
- :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gym.make`
- :attr:`metadata` - The metadata of the environment, i.e. render modes
- :attr:`np_random` - The random number generator for the environment
Note: a default reward range set to :math:`(-\infty,+\infty)` already exists. Set it if you want a narrower range.
|
class Env(Generic[ObsType, ActType]):
r"""The main OpenAI Gym class.
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
An environment can be partially or fully observed.
The main API methods that users of this class need to know are:
- :meth:`step` - Takes a step in the environment using an action returning the next observation, reward,
if the environment terminated and observation information.
- :meth:`reset` - Resets the environment to an initial state, returning the initial observation and observation information.
- :meth:`render` - Renders the environment observation with modes depending on the output
- :meth:`close` - Closes the environment, important for rendering where pygame is imported
And set the following attributes:
- :attr:`action_space` - The Space object corresponding to valid actions
- :attr:`observation_space` - The Space object corresponding to valid observations
- :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards
- :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gym.make`
- :attr:`metadata` - The metadata of the environment, i.e. render modes
- :attr:`np_random` - The random number generator for the environment
Note: a default reward range set to :math:`(-\infty,+\infty)` already exists. Set it if you want a narrower range.
"""
# Set this in SOME subclasses
metadata: Dict[str, Any] = {"render_modes": []}
# define render_mode if your environment supports rendering
render_mode: Optional[str] = None
reward_range = (-float("inf"), float("inf"))
spec: "EnvSpec" = None
# Set these in ALL subclasses
action_space: spaces.Space[ActType]
observation_space: spaces.Space[ObsType]
# Created
_np_random: Optional[np.random.Generator] = None
@property
def np_random(self) -> np.random.Generator:
"""Returns the environment's internal :attr:`_np_random` that if not set will initialise with a random seed."""
if self._np_random is None:
self._np_random, seed = seeding.np_random()
return self._np_random
@np_random.setter
def np_random(self, value: np.random.Generator):
self._np_random = value
def step(self, action: ActType) -> Tuple[ObsType, float, bool, bool, dict]:
"""Run one timestep of the environment's dynamics.
When end of episode is reached, you are responsible for calling :meth:`reset` to reset this environment's state.
Accepts an action and returns either a tuple `(observation, reward, terminated, truncated, info)`.
Args:
action (ActType): an action provided by the agent
Returns:
observation (object): this will be an element of the environment's :attr:`observation_space`.
This may, for instance, be a numpy array containing the positions and velocities of certain objects.
reward (float): The amount of reward returned as a result of taking the action.
terminated (bool): whether a `terminal state` (as defined under the MDP of the task) is reached.
In this case further step() calls could return undefined results.
truncated (bool): whether a truncation condition outside the scope of the MDP is satisfied.
Typically a timelimit, but could also be used to indicate agent physically going out of bounds.
Can be used to end the episode prematurely before a `terminal state` is reached.
info (dictionary): `info` contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
This might, for instance, contain: metrics that describe the agent's performance state, variables that are
hidden from observations, or individual reward terms that are combined to produce the total reward.
It also can contain information that distinguishes truncation and termination, however this is deprecated in favour
of returning two booleans, and will be removed in a future version.
(deprecated)
done (bool): A boolean value for if the episode has ended, in which case further :meth:`step` calls will return undefined results.
A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
a certain timelimit was exceeded, or the physics simulation has entered an invalid state.
"""
raise NotImplementedError
def reset(
self,
*,
seed: Optional[int] = None,
options: Optional[dict] = None,
) -> Tuple[ObsType, dict]:
"""Resets the environment to an initial state and returns the initial observation.
This method can reset the environment's random number generator(s) if ``seed`` is an integer or
if the environment has not yet initialized a random number generator.
If the environment already has a random number generator and :meth:`reset` is called with ``seed=None``,
the RNG should not be reset. Moreover, :meth:`reset` should (in the typical use case) be called with an
integer seed right after initialization and then never again.
Args:
seed (optional int): The seed that is used to initialize the environment's PRNG.
If the environment does not already have a PRNG and ``seed=None`` (the default option) is passed,
a seed will be chosen from some source of entropy (e.g. timestamp or /dev/urandom).
However, if the environment already has a PRNG and ``seed=None`` is passed, the PRNG will *not* be reset.
If you pass an integer, the PRNG will be reset even if it already exists.
Usually, you want to pass an integer *right after the environment has been initialized and then never again*.
Please refer to the minimal example above to see this paradigm in action.
options (optional dict): Additional information to specify how the environment is reset (optional,
depending on the specific environment)
Returns:
observation (object): Observation of the initial state. This will be an element of :attr:`observation_space`
(typically a numpy array) and is analogous to the observation returned by :meth:`step`.
info (dictionary): This dictionary contains auxiliary information complementing ``observation``. It should be analogous to
the ``info`` returned by :meth:`step`.
"""
# Initialize the RNG if the seed is manually passed
if seed is not None:
self._np_random, seed = seeding.np_random(seed)
def render(self) -> Optional[Union[RenderFrame, List[RenderFrame]]]:
"""Compute the render frames as specified by render_mode attribute during initialization of the environment.
The set of supported modes varies per environment. (And some
third-party environments may not support rendering at all.)
By convention, if render_mode is:
- None (default): no render is computed.
- human: render return None.
The environment is continuously rendered in the current display or terminal. Usually for human consumption.
- rgb_array: return a single frame representing the current state of the environment.
A frame is a numpy.ndarray with shape (x, y, 3) representing RGB values for an x-by-y pixel image.
- rgb_array_list: return a list of frames representing the states of the environment since the last reset.
Each frame is a numpy.ndarray with shape (x, y, 3), as with `rgb_array`.
- ansi: Return a strings (str) or StringIO.StringIO containing a
terminal-style text representation for each time step.
The text can include newlines and ANSI escape sequences (e.g. for colors).
Note:
Make sure that your class's metadata 'render_modes' key includes
the list of supported modes. It's recommended to call super()
in implementations to use the functionality of this method.
"""
raise NotImplementedError
def close(self):
"""Override close in your subclass to perform any necessary cleanup.
Environments will automatically :meth:`close()` themselves when
garbage collected or when the program exits.
"""
pass
@property
def unwrapped(self) -> "Env":
"""Returns the base non-wrapped environment.
Returns:
Env: The base non-wrapped gym.Env instance
"""
return self
def __str__(self):
"""Returns a string of the environment with the spec id if specified."""
if self.spec is None:
return f"<{type(self).__name__} instance>"
else:
return f"<{type(self).__name__}<{self.spec.id}>>"
def __enter__(self):
"""Support with-statement for the environment."""
return self
def __exit__(self, *args):
"""Support with-statement for the environment."""
self.close()
# propagate exception
return False
|
()
|
68,894 |
gym.core
|
__str__
|
Returns a string of the environment with the spec id if specified.
|
def __str__(self):
"""Returns a string of the environment with the spec id if specified."""
if self.spec is None:
return f"<{type(self).__name__} instance>"
else:
return f"<{type(self).__name__}<{self.spec.id}>>"
|
(self)
|
68,895 |
gym.core
|
close
|
Override close in your subclass to perform any necessary cleanup.
Environments will automatically :meth:`close()` themselves when
garbage collected or when the program exits.
|
def close(self):
"""Override close in your subclass to perform any necessary cleanup.
Environments will automatically :meth:`close()` themselves when
garbage collected or when the program exits.
"""
pass
|
(self)
|
68,896 |
gym.core
|
render
|
Compute the render frames as specified by render_mode attribute during initialization of the environment.
The set of supported modes varies per environment. (And some
third-party environments may not support rendering at all.)
By convention, if render_mode is:
- None (default): no render is computed.
- human: render return None.
The environment is continuously rendered in the current display or terminal. Usually for human consumption.
- rgb_array: return a single frame representing the current state of the environment.
A frame is a numpy.ndarray with shape (x, y, 3) representing RGB values for an x-by-y pixel image.
- rgb_array_list: return a list of frames representing the states of the environment since the last reset.
Each frame is a numpy.ndarray with shape (x, y, 3), as with `rgb_array`.
- ansi: Return a strings (str) or StringIO.StringIO containing a
terminal-style text representation for each time step.
The text can include newlines and ANSI escape sequences (e.g. for colors).
Note:
Make sure that your class's metadata 'render_modes' key includes
the list of supported modes. It's recommended to call super()
in implementations to use the functionality of this method.
|
def render(self) -> Optional[Union[RenderFrame, List[RenderFrame]]]:
"""Compute the render frames as specified by render_mode attribute during initialization of the environment.
The set of supported modes varies per environment. (And some
third-party environments may not support rendering at all.)
By convention, if render_mode is:
- None (default): no render is computed.
- human: render return None.
The environment is continuously rendered in the current display or terminal. Usually for human consumption.
- rgb_array: return a single frame representing the current state of the environment.
A frame is a numpy.ndarray with shape (x, y, 3) representing RGB values for an x-by-y pixel image.
- rgb_array_list: return a list of frames representing the states of the environment since the last reset.
Each frame is a numpy.ndarray with shape (x, y, 3), as with `rgb_array`.
- ansi: Return a strings (str) or StringIO.StringIO containing a
terminal-style text representation for each time step.
The text can include newlines and ANSI escape sequences (e.g. for colors).
Note:
Make sure that your class's metadata 'render_modes' key includes
the list of supported modes. It's recommended to call super()
in implementations to use the functionality of this method.
"""
raise NotImplementedError
|
(self) -> Union[~RenderFrame, List[~RenderFrame], NoneType]
|
68,897 |
gym.core
|
reset
|
Resets the environment to an initial state and returns the initial observation.
This method can reset the environment's random number generator(s) if ``seed`` is an integer or
if the environment has not yet initialized a random number generator.
If the environment already has a random number generator and :meth:`reset` is called with ``seed=None``,
the RNG should not be reset. Moreover, :meth:`reset` should (in the typical use case) be called with an
integer seed right after initialization and then never again.
Args:
seed (optional int): The seed that is used to initialize the environment's PRNG.
If the environment does not already have a PRNG and ``seed=None`` (the default option) is passed,
a seed will be chosen from some source of entropy (e.g. timestamp or /dev/urandom).
However, if the environment already has a PRNG and ``seed=None`` is passed, the PRNG will *not* be reset.
If you pass an integer, the PRNG will be reset even if it already exists.
Usually, you want to pass an integer *right after the environment has been initialized and then never again*.
Please refer to the minimal example above to see this paradigm in action.
options (optional dict): Additional information to specify how the environment is reset (optional,
depending on the specific environment)
Returns:
observation (object): Observation of the initial state. This will be an element of :attr:`observation_space`
(typically a numpy array) and is analogous to the observation returned by :meth:`step`.
info (dictionary): This dictionary contains auxiliary information complementing ``observation``. It should be analogous to
the ``info`` returned by :meth:`step`.
|
def reset(
self,
*,
seed: Optional[int] = None,
options: Optional[dict] = None,
) -> Tuple[ObsType, dict]:
"""Resets the environment to an initial state and returns the initial observation.
This method can reset the environment's random number generator(s) if ``seed`` is an integer or
if the environment has not yet initialized a random number generator.
If the environment already has a random number generator and :meth:`reset` is called with ``seed=None``,
the RNG should not be reset. Moreover, :meth:`reset` should (in the typical use case) be called with an
integer seed right after initialization and then never again.
Args:
seed (optional int): The seed that is used to initialize the environment's PRNG.
If the environment does not already have a PRNG and ``seed=None`` (the default option) is passed,
a seed will be chosen from some source of entropy (e.g. timestamp or /dev/urandom).
However, if the environment already has a PRNG and ``seed=None`` is passed, the PRNG will *not* be reset.
If you pass an integer, the PRNG will be reset even if it already exists.
Usually, you want to pass an integer *right after the environment has been initialized and then never again*.
Please refer to the minimal example above to see this paradigm in action.
options (optional dict): Additional information to specify how the environment is reset (optional,
depending on the specific environment)
Returns:
observation (object): Observation of the initial state. This will be an element of :attr:`observation_space`
(typically a numpy array) and is analogous to the observation returned by :meth:`step`.
info (dictionary): This dictionary contains auxiliary information complementing ``observation``. It should be analogous to
the ``info`` returned by :meth:`step`.
"""
# Initialize the RNG if the seed is manually passed
if seed is not None:
self._np_random, seed = seeding.np_random(seed)
|
(self, *, seed: Optional[int] = None, options: Optional[dict] = None) -> Tuple[~ObsType, dict]
|
68,898 |
gym.core
|
step
|
Run one timestep of the environment's dynamics.
When end of episode is reached, you are responsible for calling :meth:`reset` to reset this environment's state.
Accepts an action and returns either a tuple `(observation, reward, terminated, truncated, info)`.
Args:
action (ActType): an action provided by the agent
Returns:
observation (object): this will be an element of the environment's :attr:`observation_space`.
This may, for instance, be a numpy array containing the positions and velocities of certain objects.
reward (float): The amount of reward returned as a result of taking the action.
terminated (bool): whether a `terminal state` (as defined under the MDP of the task) is reached.
In this case further step() calls could return undefined results.
truncated (bool): whether a truncation condition outside the scope of the MDP is satisfied.
Typically a timelimit, but could also be used to indicate agent physically going out of bounds.
Can be used to end the episode prematurely before a `terminal state` is reached.
info (dictionary): `info` contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
This might, for instance, contain: metrics that describe the agent's performance state, variables that are
hidden from observations, or individual reward terms that are combined to produce the total reward.
It also can contain information that distinguishes truncation and termination, however this is deprecated in favour
of returning two booleans, and will be removed in a future version.
(deprecated)
done (bool): A boolean value for if the episode has ended, in which case further :meth:`step` calls will return undefined results.
A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
a certain timelimit was exceeded, or the physics simulation has entered an invalid state.
|
def step(self, action: ActType) -> Tuple[ObsType, float, bool, bool, dict]:
"""Run one timestep of the environment's dynamics.
When end of episode is reached, you are responsible for calling :meth:`reset` to reset this environment's state.
Accepts an action and returns either a tuple `(observation, reward, terminated, truncated, info)`.
Args:
action (ActType): an action provided by the agent
Returns:
observation (object): this will be an element of the environment's :attr:`observation_space`.
This may, for instance, be a numpy array containing the positions and velocities of certain objects.
reward (float): The amount of reward returned as a result of taking the action.
terminated (bool): whether a `terminal state` (as defined under the MDP of the task) is reached.
In this case further step() calls could return undefined results.
truncated (bool): whether a truncation condition outside the scope of the MDP is satisfied.
Typically a timelimit, but could also be used to indicate agent physically going out of bounds.
Can be used to end the episode prematurely before a `terminal state` is reached.
info (dictionary): `info` contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
This might, for instance, contain: metrics that describe the agent's performance state, variables that are
hidden from observations, or individual reward terms that are combined to produce the total reward.
It also can contain information that distinguishes truncation and termination, however this is deprecated in favour
of returning two booleans, and will be removed in a future version.
(deprecated)
done (bool): A boolean value for if the episode has ended, in which case further :meth:`step` calls will return undefined results.
A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
a certain timelimit was exceeded, or the physics simulation has entered an invalid state.
"""
raise NotImplementedError
|
(self, action: ~ActType) -> Tuple[~ObsType, float, bool, bool, dict]
|
68,899 |
gym.core
|
ObservationWrapper
|
Superclass of wrappers that can modify observations using :meth:`observation` for :meth:`reset` and :meth:`step`.
If you would like to apply a function to the observation that is returned by the base environment before
passing it to learning code, you can simply inherit from :class:`ObservationWrapper` and overwrite the method
:meth:`observation` to implement that transformation. The transformation defined in that method must be
defined on the base environment’s observation space. However, it may take values in a different space.
In that case, you need to specify the new observation space of the wrapper by setting :attr:`self.observation_space`
in the :meth:`__init__` method of your wrapper.
For example, you might have a 2D navigation task where the environment returns dictionaries as observations with
keys ``"agent_position"`` and ``"target_position"``. A common thing to do might be to throw away some degrees of
freedom and only consider the position of the target relative to the agent, i.e.
``observation["target_position"] - observation["agent_position"]``. For this, you could implement an
observation wrapper like this::
class RelativePosition(gym.ObservationWrapper):
def __init__(self, env):
super().__init__(env)
self.observation_space = Box(shape=(2,), low=-np.inf, high=np.inf)
def observation(self, obs):
return obs["target"] - obs["agent"]
Among others, Gym provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
index of the timestep to the observation.
|
class ObservationWrapper(Wrapper):
"""Superclass of wrappers that can modify observations using :meth:`observation` for :meth:`reset` and :meth:`step`.
If you would like to apply a function to the observation that is returned by the base environment before
passing it to learning code, you can simply inherit from :class:`ObservationWrapper` and overwrite the method
:meth:`observation` to implement that transformation. The transformation defined in that method must be
defined on the base environment’s observation space. However, it may take values in a different space.
In that case, you need to specify the new observation space of the wrapper by setting :attr:`self.observation_space`
in the :meth:`__init__` method of your wrapper.
For example, you might have a 2D navigation task where the environment returns dictionaries as observations with
keys ``"agent_position"`` and ``"target_position"``. A common thing to do might be to throw away some degrees of
freedom and only consider the position of the target relative to the agent, i.e.
``observation["target_position"] - observation["agent_position"]``. For this, you could implement an
observation wrapper like this::
class RelativePosition(gym.ObservationWrapper):
def __init__(self, env):
super().__init__(env)
self.observation_space = Box(shape=(2,), low=-np.inf, high=np.inf)
def observation(self, obs):
return obs["target"] - obs["agent"]
Among others, Gym provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
index of the timestep to the observation.
"""
def reset(self, **kwargs):
"""Resets the environment, returning a modified observation using :meth:`self.observation`."""
obs, info = self.env.reset(**kwargs)
return self.observation(obs), info
def step(self, action):
"""Returns a modified observation using :meth:`self.observation` after calling :meth:`env.step`."""
observation, reward, terminated, truncated, info = self.env.step(action)
return self.observation(observation), reward, terminated, truncated, info
def observation(self, observation):
"""Returns a modified observation."""
raise NotImplementedError
|
(env: gym.core.Env)
|
68,907 |
gym.core
|
observation
|
Returns a modified observation.
|
def observation(self, observation):
"""Returns a modified observation."""
raise NotImplementedError
|
(self, observation)
|
68,909 |
gym.core
|
reset
|
Resets the environment, returning a modified observation using :meth:`self.observation`.
|
def reset(self, **kwargs):
"""Resets the environment, returning a modified observation using :meth:`self.observation`."""
obs, info = self.env.reset(**kwargs)
return self.observation(obs), info
|
(self, **kwargs)
|
68,910 |
gym.core
|
step
|
Returns a modified observation using :meth:`self.observation` after calling :meth:`env.step`.
|
def step(self, action):
"""Returns a modified observation using :meth:`self.observation` after calling :meth:`env.step`."""
observation, reward, terminated, truncated, info = self.env.step(action)
return self.observation(observation), reward, terminated, truncated, info
|
(self, action)
|
68,911 |
gym.core
|
RewardWrapper
|
Superclass of wrappers that can modify the returning reward from a step.
If you would like to apply a function to the reward that is returned by the base environment before
passing it to learning code, you can simply inherit from :class:`RewardWrapper` and overwrite the method
:meth:`reward` to implement that transformation.
This transformation might change the reward range; to specify the reward range of your wrapper,
you can simply define :attr:`self.reward_range` in :meth:`__init__`.
Let us look at an example: Sometimes (especially when we do not have control over the reward
because it is intrinsic), we want to clip the reward to a range to gain some numerical stability.
To do that, we could, for instance, implement the following wrapper::
class ClipReward(gym.RewardWrapper):
def __init__(self, env, min_reward, max_reward):
super().__init__(env)
self.min_reward = min_reward
self.max_reward = max_reward
self.reward_range = (min_reward, max_reward)
def reward(self, reward):
return np.clip(reward, self.min_reward, self.max_reward)
|
class RewardWrapper(Wrapper):
"""Superclass of wrappers that can modify the returning reward from a step.
If you would like to apply a function to the reward that is returned by the base environment before
passing it to learning code, you can simply inherit from :class:`RewardWrapper` and overwrite the method
:meth:`reward` to implement that transformation.
This transformation might change the reward range; to specify the reward range of your wrapper,
you can simply define :attr:`self.reward_range` in :meth:`__init__`.
Let us look at an example: Sometimes (especially when we do not have control over the reward
because it is intrinsic), we want to clip the reward to a range to gain some numerical stability.
To do that, we could, for instance, implement the following wrapper::
class ClipReward(gym.RewardWrapper):
def __init__(self, env, min_reward, max_reward):
super().__init__(env)
self.min_reward = min_reward
self.max_reward = max_reward
self.reward_range = (min_reward, max_reward)
def reward(self, reward):
return np.clip(reward, self.min_reward, self.max_reward)
"""
def step(self, action):
"""Modifies the reward using :meth:`self.reward` after the environment :meth:`env.step`."""
observation, reward, terminated, truncated, info = self.env.step(action)
return observation, self.reward(reward), terminated, truncated, info
def reward(self, reward):
"""Returns a modified ``reward``."""
raise NotImplementedError
|
(env: gym.core.Env)
|
68,921 |
gym.core
|
reward
|
Returns a modified ``reward``.
|
def reward(self, reward):
"""Returns a modified ``reward``."""
raise NotImplementedError
|
(self, reward)
|
68,922 |
gym.core
|
step
|
Modifies the reward using :meth:`self.reward` after the environment :meth:`env.step`.
|
def step(self, action):
"""Modifies the reward using :meth:`self.reward` after the environment :meth:`env.step`."""
observation, reward, terminated, truncated, info = self.env.step(action)
return observation, self.reward(reward), terminated, truncated, info
|
(self, action)
|
68,923 |
gym.spaces.space
|
Space
|
Superclass that is used to define observation and action spaces.
Spaces are crucially used in Gym to define the format of valid actions and observations.
They serve various purposes:
* They clearly define how to interact with environments, i.e. they specify what actions need to look like
and what observations will look like
* They allow us to work with highly structured data (e.g. in the form of elements of :class:`Dict` spaces)
and painlessly transform them into flat arrays that can be used in learning code
* They provide a method to sample random elements. This is especially useful for exploration and debugging.
Different spaces can be combined hierarchically via container spaces (:class:`Tuple` and :class:`Dict`) to build a
more expressive space
Warning:
Custom observation & action spaces can inherit from the ``Space``
class. However, most use-cases should be covered by the existing space
classes (e.g. :class:`Box`, :class:`Discrete`, etc...), and container classes (:class`Tuple` &
:class:`Dict`). Note that parametrized probability distributions (through the
:meth:`Space.sample()` method), and batching functions (in :class:`gym.vector.VectorEnv`), are
only well-defined for instances of spaces provided in gym by default.
Moreover, some implementations of Reinforcement Learning algorithms might
not handle custom spaces properly. Use custom spaces with care.
|
class Space(Generic[T_cov]):
"""Superclass that is used to define observation and action spaces.
Spaces are crucially used in Gym to define the format of valid actions and observations.
They serve various purposes:
* They clearly define how to interact with environments, i.e. they specify what actions need to look like
and what observations will look like
* They allow us to work with highly structured data (e.g. in the form of elements of :class:`Dict` spaces)
and painlessly transform them into flat arrays that can be used in learning code
* They provide a method to sample random elements. This is especially useful for exploration and debugging.
Different spaces can be combined hierarchically via container spaces (:class:`Tuple` and :class:`Dict`) to build a
more expressive space
Warning:
Custom observation & action spaces can inherit from the ``Space``
class. However, most use-cases should be covered by the existing space
classes (e.g. :class:`Box`, :class:`Discrete`, etc...), and container classes (:class`Tuple` &
:class:`Dict`). Note that parametrized probability distributions (through the
:meth:`Space.sample()` method), and batching functions (in :class:`gym.vector.VectorEnv`), are
only well-defined for instances of spaces provided in gym by default.
Moreover, some implementations of Reinforcement Learning algorithms might
not handle custom spaces properly. Use custom spaces with care.
"""
def __init__(
self,
shape: Optional[Sequence[int]] = None,
dtype: Optional[Union[Type, str, np.dtype]] = None,
seed: Optional[Union[int, np.random.Generator]] = None,
):
"""Constructor of :class:`Space`.
Args:
shape (Optional[Sequence[int]]): If elements of the space are numpy arrays, this should specify their shape.
dtype (Optional[Type | str]): If elements of the space are numpy arrays, this should specify their dtype.
seed: Optionally, you can use this argument to seed the RNG that is used to sample from the space
"""
self._shape = None if shape is None else tuple(shape)
self.dtype = None if dtype is None else np.dtype(dtype)
self._np_random = None
if seed is not None:
if isinstance(seed, np.random.Generator):
self._np_random = seed
else:
self.seed(seed)
@property
def np_random(self) -> np.random.Generator:
"""Lazily seed the PRNG since this is expensive and only needed if sampling from this space."""
if self._np_random is None:
self.seed()
return self._np_random # type: ignore ## self.seed() call guarantees right type.
@property
def shape(self) -> Optional[Tuple[int, ...]]:
"""Return the shape of the space as an immutable property."""
return self._shape
@property
def is_np_flattenable(self):
"""Checks whether this space can be flattened to a :class:`spaces.Box`."""
raise NotImplementedError
def sample(self, mask: Optional[Any] = None) -> T_cov:
"""Randomly sample an element of this space.
Can be uniform or non-uniform sampling based on boundedness of space.
Args:
mask: A mask used for sampling, expected ``dtype=np.int8`` and see sample implementation for expected shape.
Returns:
A sampled actions from the space
"""
raise NotImplementedError
def seed(self, seed: Optional[int] = None) -> list:
"""Seed the PRNG of this space and possibly the PRNGs of subspaces."""
self._np_random, seed = seeding.np_random(seed)
return [seed]
def contains(self, x) -> bool:
"""Return boolean specifying if x is a valid member of this space."""
raise NotImplementedError
def __contains__(self, x) -> bool:
"""Return boolean specifying if x is a valid member of this space."""
return self.contains(x)
def __setstate__(self, state: Union[Iterable, Mapping]):
"""Used when loading a pickled space.
This method was implemented explicitly to allow for loading of legacy states.
Args:
state: The updated state value
"""
# Don't mutate the original state
state = dict(state)
# Allow for loading of legacy states.
# See:
# https://github.com/openai/gym/pull/2397 -- shape
# https://github.com/openai/gym/pull/1913 -- np_random
#
if "shape" in state:
state["_shape"] = state["shape"]
del state["shape"]
if "np_random" in state:
state["_np_random"] = state["np_random"]
del state["np_random"]
# Update our state
self.__dict__.update(state)
def to_jsonable(self, sample_n: Sequence[T_cov]) -> list:
"""Convert a batch of samples from this space to a JSONable data type."""
# By default, assume identity is JSONable
return list(sample_n)
def from_jsonable(self, sample_n: list) -> List[T_cov]:
"""Convert a JSONable data type to a batch of samples from this space."""
# By default, assume identity is JSONable
return sample_n
|
(shape: Optional[Sequence[int]] = None, dtype: Union[Type, str, numpy.dtype, NoneType] = None, seed: Union[int, numpy.random._generator.Generator, NoneType] = None)
|
68,924 |
gym.spaces.space
|
__contains__
|
Return boolean specifying if x is a valid member of this space.
|
def __contains__(self, x) -> bool:
"""Return boolean specifying if x is a valid member of this space."""
return self.contains(x)
|
(self, x) -> bool
|
68,925 |
gym.spaces.space
|
__init__
|
Constructor of :class:`Space`.
Args:
shape (Optional[Sequence[int]]): If elements of the space are numpy arrays, this should specify their shape.
dtype (Optional[Type | str]): If elements of the space are numpy arrays, this should specify their dtype.
seed: Optionally, you can use this argument to seed the RNG that is used to sample from the space
|
def __init__(
self,
shape: Optional[Sequence[int]] = None,
dtype: Optional[Union[Type, str, np.dtype]] = None,
seed: Optional[Union[int, np.random.Generator]] = None,
):
"""Constructor of :class:`Space`.
Args:
shape (Optional[Sequence[int]]): If elements of the space are numpy arrays, this should specify their shape.
dtype (Optional[Type | str]): If elements of the space are numpy arrays, this should specify their dtype.
seed: Optionally, you can use this argument to seed the RNG that is used to sample from the space
"""
self._shape = None if shape is None else tuple(shape)
self.dtype = None if dtype is None else np.dtype(dtype)
self._np_random = None
if seed is not None:
if isinstance(seed, np.random.Generator):
self._np_random = seed
else:
self.seed(seed)
|
(self, shape: Optional[Sequence[int]] = None, dtype: Union[Type, str, numpy.dtype, NoneType] = None, seed: Union[int, numpy.random._generator.Generator, NoneType] = None)
|
68,926 |
gym.spaces.space
|
__setstate__
|
Used when loading a pickled space.
This method was implemented explicitly to allow for loading of legacy states.
Args:
state: The updated state value
|
def __setstate__(self, state: Union[Iterable, Mapping]):
"""Used when loading a pickled space.
This method was implemented explicitly to allow for loading of legacy states.
Args:
state: The updated state value
"""
# Don't mutate the original state
state = dict(state)
# Allow for loading of legacy states.
# See:
# https://github.com/openai/gym/pull/2397 -- shape
# https://github.com/openai/gym/pull/1913 -- np_random
#
if "shape" in state:
state["_shape"] = state["shape"]
del state["shape"]
if "np_random" in state:
state["_np_random"] = state["np_random"]
del state["np_random"]
# Update our state
self.__dict__.update(state)
|
(self, state: Union[Iterable, Mapping])
|
68,927 |
gym.spaces.space
|
contains
|
Return boolean specifying if x is a valid member of this space.
|
def contains(self, x) -> bool:
"""Return boolean specifying if x is a valid member of this space."""
raise NotImplementedError
|
(self, x) -> bool
|
68,928 |
gym.spaces.space
|
from_jsonable
|
Convert a JSONable data type to a batch of samples from this space.
|
def from_jsonable(self, sample_n: list) -> List[T_cov]:
"""Convert a JSONable data type to a batch of samples from this space."""
# By default, assume identity is JSONable
return sample_n
|
(self, sample_n: list) -> List[+T_cov]
|
68,929 |
gym.spaces.space
|
sample
|
Randomly sample an element of this space.
Can be uniform or non-uniform sampling based on boundedness of space.
Args:
mask: A mask used for sampling, expected ``dtype=np.int8`` and see sample implementation for expected shape.
Returns:
A sampled actions from the space
|
def sample(self, mask: Optional[Any] = None) -> T_cov:
"""Randomly sample an element of this space.
Can be uniform or non-uniform sampling based on boundedness of space.
Args:
mask: A mask used for sampling, expected ``dtype=np.int8`` and see sample implementation for expected shape.
Returns:
A sampled actions from the space
"""
raise NotImplementedError
|
(self, mask: Optional[Any] = None) -> +T_cov
|
68,930 |
gym.spaces.space
|
seed
|
Seed the PRNG of this space and possibly the PRNGs of subspaces.
|
def seed(self, seed: Optional[int] = None) -> list:
"""Seed the PRNG of this space and possibly the PRNGs of subspaces."""
self._np_random, seed = seeding.np_random(seed)
return [seed]
|
(self, seed: Optional[int] = None) -> list
|
68,931 |
gym.spaces.space
|
to_jsonable
|
Convert a batch of samples from this space to a JSONable data type.
|
def to_jsonable(self, sample_n: Sequence[T_cov]) -> list:
"""Convert a batch of samples from this space to a JSONable data type."""
# By default, assume identity is JSONable
return list(sample_n)
|
(self, sample_n: Sequence[+T_cov]) -> list
|
68,932 |
gym.core
|
Wrapper
|
Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods.
This class is the base class for all wrappers. The subclass could override
some methods to change the behavior of the original environment without touching the
original code.
Note:
Don't forget to call ``super().__init__(env)`` if the subclass overrides :meth:`__init__`.
|
class Wrapper(Env[ObsType, ActType]):
"""Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods.
This class is the base class for all wrappers. The subclass could override
some methods to change the behavior of the original environment without touching the
original code.
Note:
Don't forget to call ``super().__init__(env)`` if the subclass overrides :meth:`__init__`.
"""
def __init__(self, env: Env):
"""Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods.
Args:
env: The environment to wrap
"""
self.env = env
self._action_space: Optional[spaces.Space] = None
self._observation_space: Optional[spaces.Space] = None
self._reward_range: Optional[Tuple[SupportsFloat, SupportsFloat]] = None
self._metadata: Optional[dict] = None
def __getattr__(self, name):
"""Returns an attribute with ``name``, unless ``name`` starts with an underscore."""
if name.startswith("_"):
raise AttributeError(f"accessing private attribute '{name}' is prohibited")
return getattr(self.env, name)
@property
def spec(self):
"""Returns the environment specification."""
return self.env.spec
@classmethod
def class_name(cls):
"""Returns the class name of the wrapper."""
return cls.__name__
@property
def action_space(self) -> spaces.Space[ActType]:
"""Returns the action space of the environment."""
if self._action_space is None:
return self.env.action_space
return self._action_space
@action_space.setter
def action_space(self, space: spaces.Space):
self._action_space = space
@property
def observation_space(self) -> spaces.Space:
"""Returns the observation space of the environment."""
if self._observation_space is None:
return self.env.observation_space
return self._observation_space
@observation_space.setter
def observation_space(self, space: spaces.Space):
self._observation_space = space
@property
def reward_range(self) -> Tuple[SupportsFloat, SupportsFloat]:
"""Return the reward range of the environment."""
if self._reward_range is None:
return self.env.reward_range
return self._reward_range
@reward_range.setter
def reward_range(self, value: Tuple[SupportsFloat, SupportsFloat]):
self._reward_range = value
@property
def metadata(self) -> dict:
"""Returns the environment metadata."""
if self._metadata is None:
return self.env.metadata
return self._metadata
@metadata.setter
def metadata(self, value):
self._metadata = value
@property
def render_mode(self) -> Optional[str]:
"""Returns the environment render_mode."""
return self.env.render_mode
@property
def np_random(self) -> np.random.Generator:
"""Returns the environment np_random."""
return self.env.np_random
@np_random.setter
def np_random(self, value):
self.env.np_random = value
@property
def _np_random(self):
raise AttributeError(
"Can't access `_np_random` of a wrapper, use `.unwrapped._np_random` or `.np_random`."
)
def step(self, action: ActType) -> Tuple[ObsType, float, bool, bool, dict]:
"""Steps through the environment with action."""
return self.env.step(action)
def reset(self, **kwargs) -> Tuple[ObsType, dict]:
"""Resets the environment with kwargs."""
return self.env.reset(**kwargs)
def render(
self, *args, **kwargs
) -> Optional[Union[RenderFrame, List[RenderFrame]]]:
"""Renders the environment."""
return self.env.render(*args, **kwargs)
def close(self):
"""Closes the environment."""
return self.env.close()
def __str__(self):
"""Returns the wrapper name and the unwrapped environment string."""
return f"<{type(self).__name__}{self.env}>"
def __repr__(self):
"""Returns the string representation of the wrapper."""
return str(self)
@property
def unwrapped(self) -> Env:
"""Returns the base environment of the wrapper."""
return self.env.unwrapped
|
(env: gym.core.Env)
|
68,942 |
gym.core
|
step
|
Steps through the environment with action.
|
def step(self, action: ActType) -> Tuple[ObsType, float, bool, bool, dict]:
"""Steps through the environment with action."""
return self.env.step(action)
|
(self, action: ~ActType) -> Tuple[~ObsType, float, bool, bool, dict]
|
68,947 |
gym.envs.registration
|
make
|
Create an environment according to the given ID.
To find all available environments use `gym.envs.registry.keys()` for all valid ids.
Args:
id: Name of the environment. Optionally, a module to import can be included, eg. 'module:Env-v0'
max_episode_steps: Maximum length of an episode (TimeLimit wrapper).
autoreset: Whether to automatically reset the environment after each episode (AutoResetWrapper).
apply_api_compatibility: Whether to wrap the environment with the `StepAPICompatibility` wrapper that
converts the environment step from a done bool to return termination and truncation bools.
By default, the argument is None to which the environment specification `apply_api_compatibility` is used
which defaults to False. Otherwise, the value of `apply_api_compatibility` is used.
If `True`, the wrapper is applied otherwise, the wrapper is not applied.
disable_env_checker: If to run the env checker, None will default to the environment specification `disable_env_checker`
(which is by default False, running the environment checker),
otherwise will run according to this parameter (`True` = not run, `False` = run)
kwargs: Additional arguments to pass to the environment constructor.
Returns:
An instance of the environment.
Raises:
Error: If the ``id`` doesn't exist then an error is raised
|
def make(
id: Union[str, EnvSpec],
max_episode_steps: Optional[int] = None,
autoreset: bool = False,
apply_api_compatibility: Optional[bool] = None,
disable_env_checker: Optional[bool] = None,
**kwargs,
) -> Env:
"""Create an environment according to the given ID.
To find all available environments use `gym.envs.registry.keys()` for all valid ids.
Args:
id: Name of the environment. Optionally, a module to import can be included, eg. 'module:Env-v0'
max_episode_steps: Maximum length of an episode (TimeLimit wrapper).
autoreset: Whether to automatically reset the environment after each episode (AutoResetWrapper).
apply_api_compatibility: Whether to wrap the environment with the `StepAPICompatibility` wrapper that
converts the environment step from a done bool to return termination and truncation bools.
By default, the argument is None to which the environment specification `apply_api_compatibility` is used
which defaults to False. Otherwise, the value of `apply_api_compatibility` is used.
If `True`, the wrapper is applied otherwise, the wrapper is not applied.
disable_env_checker: If to run the env checker, None will default to the environment specification `disable_env_checker`
(which is by default False, running the environment checker),
otherwise will run according to this parameter (`True` = not run, `False` = run)
kwargs: Additional arguments to pass to the environment constructor.
Returns:
An instance of the environment.
Raises:
Error: If the ``id`` doesn't exist then an error is raised
"""
if isinstance(id, EnvSpec):
spec_ = id
else:
module, id = (None, id) if ":" not in id else id.split(":")
if module is not None:
try:
importlib.import_module(module)
except ModuleNotFoundError as e:
raise ModuleNotFoundError(
f"{e}. Environment registration via importing a module failed. "
f"Check whether '{module}' contains env registration and can be imported."
)
spec_ = registry.get(id)
ns, name, version = parse_env_id(id)
latest_version = find_highest_version(ns, name)
if (
version is not None
and latest_version is not None
and latest_version > version
):
logger.warn(
f"The environment {id} is out of date. You should consider "
f"upgrading to version `v{latest_version}`."
)
if version is None and latest_version is not None:
version = latest_version
new_env_id = get_env_id(ns, name, version)
spec_ = registry.get(new_env_id)
logger.warn(
f"Using the latest versioned environment `{new_env_id}` "
f"instead of the unversioned environment `{id}`."
)
if spec_ is None:
_check_version_exists(ns, name, version)
raise error.Error(f"No registered env with id: {id}")
_kwargs = spec_.kwargs.copy()
_kwargs.update(kwargs)
if spec_.entry_point is None:
raise error.Error(f"{spec_.id} registered but entry_point is not specified")
elif callable(spec_.entry_point):
env_creator = spec_.entry_point
else:
# Assume it's a string
env_creator = load(spec_.entry_point)
mode = _kwargs.get("render_mode")
apply_human_rendering = False
apply_render_collection = False
# If we have access to metadata we check that "render_mode" is valid and see if the HumanRendering wrapper needs to be applied
if mode is not None and hasattr(env_creator, "metadata"):
assert isinstance(
env_creator.metadata, dict
), f"Expect the environment creator ({env_creator}) metadata to be dict, actual type: {type(env_creator.metadata)}"
if "render_modes" in env_creator.metadata:
render_modes = env_creator.metadata["render_modes"]
if not isinstance(render_modes, Sequence):
logger.warn(
f"Expects the environment metadata render_modes to be a Sequence (tuple or list), actual type: {type(render_modes)}"
)
# Apply the `HumanRendering` wrapper, if the mode=="human" but "human" not in render_modes
if (
mode == "human"
and "human" not in render_modes
and ("rgb_array" in render_modes or "rgb_array_list" in render_modes)
):
logger.warn(
"You are trying to use 'human' rendering for an environment that doesn't natively support it. "
"The HumanRendering wrapper is being applied to your environment."
)
apply_human_rendering = True
if "rgb_array" in render_modes:
_kwargs["render_mode"] = "rgb_array"
else:
_kwargs["render_mode"] = "rgb_array_list"
elif (
mode not in render_modes
and mode.endswith("_list")
and mode[: -len("_list")] in render_modes
):
_kwargs["render_mode"] = mode[: -len("_list")]
apply_render_collection = True
elif mode not in render_modes:
logger.warn(
f"The environment is being initialised with mode ({mode}) that is not in the possible render_modes ({render_modes})."
)
else:
logger.warn(
f"The environment creator metadata doesn't include `render_modes`, contains: {list(env_creator.metadata.keys())}"
)
if apply_api_compatibility is True or (
apply_api_compatibility is None and spec_.apply_api_compatibility is True
):
# If we use the compatibility layer, we treat the render mode explicitly and don't pass it to the env creator
render_mode = _kwargs.pop("render_mode", None)
else:
render_mode = None
try:
env = env_creator(**_kwargs)
except TypeError as e:
if (
str(e).find("got an unexpected keyword argument 'render_mode'") >= 0
and apply_human_rendering
):
raise error.Error(
f"You passed render_mode='human' although {id} doesn't implement human-rendering natively. "
"Gym tried to apply the HumanRendering wrapper but it looks like your environment is using the old "
"rendering API, which is not supported by the HumanRendering wrapper."
)
else:
raise e
# Copies the environment creation specification and kwargs to add to the environment specification details
spec_ = copy.deepcopy(spec_)
spec_.kwargs = _kwargs
env.unwrapped.spec = spec_
# Add step API wrapper
if apply_api_compatibility is True or (
apply_api_compatibility is None and spec_.apply_api_compatibility is True
):
env = EnvCompatibility(env, render_mode)
# Run the environment checker as the lowest level wrapper
if disable_env_checker is False or (
disable_env_checker is None and spec_.disable_env_checker is False
):
env = PassiveEnvChecker(env)
# Add the order enforcing wrapper
if spec_.order_enforce:
env = OrderEnforcing(env)
# Add the time limit wrapper
if max_episode_steps is not None:
env = TimeLimit(env, max_episode_steps)
elif spec_.max_episode_steps is not None:
env = TimeLimit(env, spec_.max_episode_steps)
# Add the autoreset wrapper
if autoreset:
env = AutoResetWrapper(env)
# Add human rendering wrapper
if apply_human_rendering:
env = HumanRendering(env)
elif apply_render_collection:
env = RenderCollection(env)
return env
|
(id: Union[str, gym.envs.registration.EnvSpec], max_episode_steps: Optional[int] = None, autoreset: bool = False, apply_api_compatibility: Optional[bool] = None, disable_env_checker: Optional[bool] = None, **kwargs) -> gym.core.Env
|
68,950 |
gym.envs.registration
|
register
|
Register an environment with gym.
The `id` parameter corresponds to the name of the environment, with the syntax as follows:
`(namespace)/(env_name)-v(version)` where `namespace` is optional.
It takes arbitrary keyword arguments, which are passed to the `EnvSpec` constructor.
Args:
id: The environment id
entry_point: The entry point for creating the environment
reward_threshold: The reward threshold considered to have learnt an environment
nondeterministic: If the environment is nondeterministic (even with knowledge of the initial seed and all actions)
max_episode_steps: The maximum number of episodes steps before truncation. Used by the Time Limit wrapper.
order_enforce: If to enable the order enforcer wrapper to ensure users run functions in the correct order
autoreset: If to add the autoreset wrapper such that reset does not need to be called.
disable_env_checker: If to disable the environment checker for the environment. Recommended to False.
apply_api_compatibility: If to apply the `StepAPICompatibility` wrapper.
**kwargs: arbitrary keyword arguments which are passed to the environment constructor
|
def register(
id: str,
entry_point: Union[Callable, str],
reward_threshold: Optional[float] = None,
nondeterministic: bool = False,
max_episode_steps: Optional[int] = None,
order_enforce: bool = True,
autoreset: bool = False,
disable_env_checker: bool = False,
apply_api_compatibility: bool = False,
**kwargs,
):
"""Register an environment with gym.
The `id` parameter corresponds to the name of the environment, with the syntax as follows:
`(namespace)/(env_name)-v(version)` where `namespace` is optional.
It takes arbitrary keyword arguments, which are passed to the `EnvSpec` constructor.
Args:
id: The environment id
entry_point: The entry point for creating the environment
reward_threshold: The reward threshold considered to have learnt an environment
nondeterministic: If the environment is nondeterministic (even with knowledge of the initial seed and all actions)
max_episode_steps: The maximum number of episodes steps before truncation. Used by the Time Limit wrapper.
order_enforce: If to enable the order enforcer wrapper to ensure users run functions in the correct order
autoreset: If to add the autoreset wrapper such that reset does not need to be called.
disable_env_checker: If to disable the environment checker for the environment. Recommended to False.
apply_api_compatibility: If to apply the `StepAPICompatibility` wrapper.
**kwargs: arbitrary keyword arguments which are passed to the environment constructor
"""
global registry, current_namespace
ns, name, version = parse_env_id(id)
if current_namespace is not None:
if (
kwargs.get("namespace") is not None
and kwargs.get("namespace") != current_namespace
):
logger.warn(
f"Custom namespace `{kwargs.get('namespace')}` is being overridden by namespace `{current_namespace}`. "
f"If you are developing a plugin you shouldn't specify a namespace in `register` calls. "
"The namespace is specified through the entry point package metadata."
)
ns_id = current_namespace
else:
ns_id = ns
full_id = get_env_id(ns_id, name, version)
new_spec = EnvSpec(
id=full_id,
entry_point=entry_point,
reward_threshold=reward_threshold,
nondeterministic=nondeterministic,
max_episode_steps=max_episode_steps,
order_enforce=order_enforce,
autoreset=autoreset,
disable_env_checker=disable_env_checker,
apply_api_compatibility=apply_api_compatibility,
**kwargs,
)
_check_spec_register(new_spec)
if new_spec.id in registry:
logger.warn(f"Overriding environment {new_spec.id} already in registry.")
registry[new_spec.id] = new_spec
|
(id: str, entry_point: Union[Callable, str], reward_threshold: Optional[float] = None, nondeterministic: bool = False, max_episode_steps: Optional[int] = None, order_enforce: bool = True, autoreset: bool = False, disable_env_checker: bool = False, apply_api_compatibility: bool = False, **kwargs)
|
68,952 |
gym.envs.registration
|
spec
|
Retrieve the spec for the given environment from the global registry.
|
def spec(env_id: str) -> EnvSpec:
"""Retrieve the spec for the given environment from the global registry."""
spec_ = registry.get(env_id)
if spec_ is None:
ns, name, version = parse_env_id(env_id)
_check_version_exists(ns, name, version)
raise error.Error(f"No registered env with id: {env_id}")
else:
assert isinstance(spec_, EnvSpec)
return spec_
|
(env_id: str) -> gym.envs.registration.EnvSpec
|
68,958 |
defusedxml.common
|
DTDForbidden
|
Document type definition is forbidden
|
class DTDForbidden(DefusedXmlException):
"""Document type definition is forbidden"""
def __init__(self, name, sysid, pubid):
super(DTDForbidden, self).__init__()
self.name = name
self.sysid = sysid
self.pubid = pubid
def __str__(self):
tpl = "DTDForbidden(name='{}', system_id={!r}, public_id={!r})"
return tpl.format(self.name, self.sysid, self.pubid)
|
(name, sysid, pubid)
|
68,959 |
defusedxml.common
|
__init__
| null |
def __init__(self, name, sysid, pubid):
super(DTDForbidden, self).__init__()
self.name = name
self.sysid = sysid
self.pubid = pubid
|
(self, name, sysid, pubid)
|
68,961 |
defusedxml.common
|
__str__
| null |
def __str__(self):
tpl = "DTDForbidden(name='{}', system_id={!r}, public_id={!r})"
return tpl.format(self.name, self.sysid, self.pubid)
|
(self)
|
68,962 |
defusedxml.common
|
DefusedXmlException
|
Base exception
|
class DefusedXmlException(ValueError):
"""Base exception"""
def __repr__(self):
return str(self)
| null |
68,964 |
defusedxml.common
|
EntitiesForbidden
|
Entity definition is forbidden
|
class EntitiesForbidden(DefusedXmlException):
"""Entity definition is forbidden"""
def __init__(self, name, value, base, sysid, pubid, notation_name):
super(EntitiesForbidden, self).__init__()
self.name = name
self.value = value
self.base = base
self.sysid = sysid
self.pubid = pubid
self.notation_name = notation_name
def __str__(self):
tpl = "EntitiesForbidden(name='{}', system_id={!r}, public_id={!r})"
return tpl.format(self.name, self.sysid, self.pubid)
|
(name, value, base, sysid, pubid, notation_name)
|
68,965 |
defusedxml.common
|
__init__
| null |
def __init__(self, name, value, base, sysid, pubid, notation_name):
super(EntitiesForbidden, self).__init__()
self.name = name
self.value = value
self.base = base
self.sysid = sysid
self.pubid = pubid
self.notation_name = notation_name
|
(self, name, value, base, sysid, pubid, notation_name)
|
68,967 |
defusedxml.common
|
__str__
| null |
def __str__(self):
tpl = "EntitiesForbidden(name='{}', system_id={!r}, public_id={!r})"
return tpl.format(self.name, self.sysid, self.pubid)
|
(self)
|
68,968 |
defusedxml.common
|
ExternalReferenceForbidden
|
Resolving an external reference is forbidden
|
class ExternalReferenceForbidden(DefusedXmlException):
"""Resolving an external reference is forbidden"""
def __init__(self, context, base, sysid, pubid):
super(ExternalReferenceForbidden, self).__init__()
self.context = context
self.base = base
self.sysid = sysid
self.pubid = pubid
def __str__(self):
tpl = "ExternalReferenceForbidden(system_id='{}', public_id={})"
return tpl.format(self.sysid, self.pubid)
|
(context, base, sysid, pubid)
|
68,969 |
defusedxml.common
|
__init__
| null |
def __init__(self, context, base, sysid, pubid):
super(ExternalReferenceForbidden, self).__init__()
self.context = context
self.base = base
self.sysid = sysid
self.pubid = pubid
|
(self, context, base, sysid, pubid)
|
68,971 |
defusedxml.common
|
__str__
| null |
def __str__(self):
tpl = "ExternalReferenceForbidden(system_id='{}', public_id={})"
return tpl.format(self.sysid, self.pubid)
|
(self)
|
68,972 |
defusedxml.common
|
NotSupportedError
|
The operation is not supported
|
class NotSupportedError(DefusedXmlException):
"""The operation is not supported"""
| null |
68,974 |
defusedxml.common
|
_apply_defusing
| null |
def _apply_defusing(defused_mod):
assert defused_mod is sys.modules[defused_mod.__name__]
stdlib_name = defused_mod.__origin__
__import__(stdlib_name, {}, {}, ["*"])
stdlib_mod = sys.modules[stdlib_name]
stdlib_names = set(dir(stdlib_mod))
for name, obj in vars(defused_mod).items():
if name.startswith("_") or name not in stdlib_names:
continue
setattr(stdlib_mod, name, obj)
return stdlib_mod
|
(defused_mod)
|
68,976 |
defusedxml
|
defuse_stdlib
|
Monkey patch and defuse all stdlib packages
:warning: The monkey patch is an EXPERIMETNAL feature.
|
def defuse_stdlib():
"""Monkey patch and defuse all stdlib packages
:warning: The monkey patch is an EXPERIMETNAL feature.
"""
defused = {}
with warnings.catch_warnings():
from . import cElementTree
from . import ElementTree
from . import minidom
from . import pulldom
from . import sax
from . import expatbuilder
from . import expatreader
from . import xmlrpc
xmlrpc.monkey_patch()
defused[xmlrpc] = None
defused_mods = [
cElementTree,
ElementTree,
minidom,
pulldom,
sax,
expatbuilder,
expatreader,
]
for defused_mod in defused_mods:
stdlib_mod = _apply_defusing(defused_mod)
defused[defused_mod] = stdlib_mod
return defused
|
()
|
68,978 |
mailchimp_marketing.api.account_export_api
|
AccountExportApi
|
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
|
class AccountExportApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client):
self.api_client = api_client
def get_account_exports(self, export_id, **kwargs): # noqa: E501
"""Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_account_exports_with_http_info(export_id, **kwargs) # noqa: E501
else:
(data) = self.get_account_exports_with_http_info(export_id, **kwargs) # noqa: E501
return data
def get_account_exports_with_http_info(self, export_id, **kwargs): # noqa: E501
"""Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports_with_http_info(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['export_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_account_exports" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'export_id' is set
if ('export_id' not in params or
params['export_id'] is None):
raise ValueError("Missing the required parameter `export_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'export_id' in params:
path_params['export_id'] = params['export_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports/{export_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001Exports', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(api_client)
|
68,979 |
mailchimp_marketing.api.account_export_api
|
__init__
| null |
def __init__(self, api_client):
self.api_client = api_client
|
(self, api_client)
|
68,980 |
mailchimp_marketing.api.account_export_api
|
get_account_exports
|
Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
|
def get_account_exports(self, export_id, **kwargs): # noqa: E501
"""Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_account_exports_with_http_info(export_id, **kwargs) # noqa: E501
else:
(data) = self.get_account_exports_with_http_info(export_id, **kwargs) # noqa: E501
return data
|
(self, export_id, **kwargs)
|
68,981 |
mailchimp_marketing.api.account_export_api
|
get_account_exports_with_http_info
|
Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports_with_http_info(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
|
def get_account_exports_with_http_info(self, export_id, **kwargs): # noqa: E501
"""Get account export info # noqa: E501
Get information about a specific account export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_account_exports_with_http_info(export_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str export_id: The unique id for the account export. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['export_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_account_exports" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'export_id' is set
if ('export_id' not in params or
params['export_id'] is None):
raise ValueError("Missing the required parameter `export_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'export_id' in params:
path_params['export_id'] = params['export_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports/{export_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001Exports', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, export_id, **kwargs)
|
68,982 |
mailchimp_marketing.api.account_exports_api
|
AccountExportsApi
|
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
|
class AccountExportsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client):
self.api_client = api_client
def list_account_exports(self, **kwargs): # noqa: E501
"""List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_account_exports_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_account_exports_with_http_info(**kwargs) # noqa: E501
return data
def list_account_exports_with_http_info(self, **kwargs): # noqa: E501
"""List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['fields', 'exclude_fields', 'count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_account_exports" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_account_export(self, body, **kwargs): # noqa: E501
"""Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_account_export_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_account_export_with_http_info(body, **kwargs) # noqa: E501
return data
def create_account_export_with_http_info(self, body, **kwargs): # noqa: E501
"""Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_account_export" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001Exports', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(api_client)
|
68,984 |
mailchimp_marketing.api.account_exports_api
|
create_account_export
|
Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
|
def create_account_export(self, body, **kwargs): # noqa: E501
"""Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_account_export_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_account_export_with_http_info(body, **kwargs) # noqa: E501
return data
|
(self, body, **kwargs)
|
68,985 |
mailchimp_marketing.api.account_exports_api
|
create_account_export_with_http_info
|
Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
|
def create_account_export_with_http_info(self, body, **kwargs): # noqa: E501
"""Add export # noqa: E501
Create a new account export in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_account_export_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param CreateAnAccountExport body: (required)
:return: InlineResponse2001Exports
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_account_export" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001Exports', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, body, **kwargs)
|
68,986 |
mailchimp_marketing.api.account_exports_api
|
list_account_exports
|
List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
|
def list_account_exports(self, **kwargs): # noqa: E501
"""List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_account_exports_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_account_exports_with_http_info(**kwargs) # noqa: E501
return data
|
(self, **kwargs)
|
68,987 |
mailchimp_marketing.api.account_exports_api
|
list_account_exports_with_http_info
|
List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
|
def list_account_exports_with_http_info(self, **kwargs): # noqa: E501
"""List account exports # noqa: E501
Get a list of account exports for a given account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_account_exports_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2001
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['fields', 'exclude_fields', 'count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_account_exports" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/account-exports', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2001', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, **kwargs)
|
68,988 |
mailchimp_marketing.api.activity_feed_api
|
ActivityFeedApi
|
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
|
class ActivityFeedApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client):
self.api_client = api_client
def get_chimp_chatter(self, **kwargs): # noqa: E501
"""Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_chimp_chatter_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_chimp_chatter_with_http_info(**kwargs) # noqa: E501
return data
def get_chimp_chatter_with_http_info(self, **kwargs): # noqa: E501
"""Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_chimp_chatter" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/activity-feed/chimp-chatter', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse200', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(api_client)
|
68,990 |
mailchimp_marketing.api.activity_feed_api
|
get_chimp_chatter
|
Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
|
def get_chimp_chatter(self, **kwargs): # noqa: E501
"""Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_chimp_chatter_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_chimp_chatter_with_http_info(**kwargs) # noqa: E501
return data
|
(self, **kwargs)
|
68,991 |
mailchimp_marketing.api.activity_feed_api
|
get_chimp_chatter_with_http_info
|
Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
|
def get_chimp_chatter_with_http_info(self, **kwargs): # noqa: E501
"""Get latest chimp chatter # noqa: E501
Return the Chimp Chatter for this account ordered by most recent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_chimp_chatter_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_chimp_chatter" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/activity-feed/chimp-chatter', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse200', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, **kwargs)
|
68,992 |
mailchimp_marketing.api_client
|
ApiClient
| null |
class ApiClient(object):
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
def __init__(self, config = {}):
self.host = "https://server.api.mailchimp.com/3.0"
self.default_headers = {
'Content-Type': 'application/json',
'User-Agent': 'Swagger-Codegen/3.0.80/python'
}
self.set_config(config)
def get_server_from_api_key(self, api_key):
try:
split = api_key.split('-')
server = 'invalid-server'
if len(split) == 2:
server = split[1]
return server
except:
return ''
def set_config(self, config = {}):
# Basic Auth
self.api_key = config['api_key'] if 'api_key' in config.keys() else ''
self.is_basic_auth = self.api_key != ''
# OAuth
self.access_token = config['access_token'] if 'access_token' in config.keys() else ''
self.is_oauth = self.access_token != ''
# If using Basic auth and no server is provided,
# attempt to extract it from the api_key directly.
self.server = config['server'] if 'server' in config.keys() else 'invalid-server'
if self.server == 'invalid-server' and self.is_basic_auth:
self.server = self.get_server_from_api_key(self.api_key)
self.timeout = config['timeout'] if 'timeout' in config.keys() else 120
def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, collection_formats=None, **kwargs):
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params, collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v))
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params, collection_formats)
# request url
url = self.host + resource_path
if self.server:
url = url.replace('server', self.server)
# perform request and return response
try:
res = self.request(method, url, query_params, headers=header_params, body=body)
except Exception as err:
raise ApiClientError(err)
try:
if 'application/json' in res.headers.get('content-type'):
data = res.json()
else:
data = res.text
except Exception as err:
data = None
if data:
if (res.ok):
return data
else:
raise ApiClientError(text = data, status_code = res.status_code)
else:
return res
def request(self, method, url, query_params=None, headers=None, body=None):
auth = None
if self.is_basic_auth:
auth = ('user', self.api_key)
if self.is_oauth:
headers.update({ 'Authorization': 'Bearer ' + self.access_token })
if method == "GET":
return requests.get(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "HEAD":
return requests.head(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "OPTIONS":
return requests.options(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "POST":
return requests.post(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "PUT":
return requests.put(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "PATCH":
return requests.patch(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "DELETE":
return requests.delete(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `swagger_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.swagger_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
|
(config={})
|
68,993 |
mailchimp_marketing.api_client
|
__init__
| null |
def __init__(self, config = {}):
self.host = "https://server.api.mailchimp.com/3.0"
self.default_headers = {
'Content-Type': 'application/json',
'User-Agent': 'Swagger-Codegen/3.0.80/python'
}
self.set_config(config)
|
(self, config={})
|
68,994 |
mailchimp_marketing.api_client
|
call_api
| null |
def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, collection_formats=None, **kwargs):
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params, collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v))
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params, collection_formats)
# request url
url = self.host + resource_path
if self.server:
url = url.replace('server', self.server)
# perform request and return response
try:
res = self.request(method, url, query_params, headers=header_params, body=body)
except Exception as err:
raise ApiClientError(err)
try:
if 'application/json' in res.headers.get('content-type'):
data = res.json()
else:
data = res.text
except Exception as err:
data = None
if data:
if (res.ok):
return data
else:
raise ApiClientError(text = data, status_code = res.status_code)
else:
return res
|
(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, collection_formats=None, **kwargs)
|
68,995 |
mailchimp_marketing.api_client
|
get_server_from_api_key
| null |
def get_server_from_api_key(self, api_key):
try:
split = api_key.split('-')
server = 'invalid-server'
if len(split) == 2:
server = split[1]
return server
except:
return ''
|
(self, api_key)
|
68,997 |
mailchimp_marketing.api_client
|
request
| null |
def request(self, method, url, query_params=None, headers=None, body=None):
auth = None
if self.is_basic_auth:
auth = ('user', self.api_key)
if self.is_oauth:
headers.update({ 'Authorization': 'Bearer ' + self.access_token })
if method == "GET":
return requests.get(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "HEAD":
return requests.head(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "OPTIONS":
return requests.options(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "POST":
return requests.post(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "PUT":
return requests.put(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "PATCH":
return requests.patch(url, data=json.dumps(body), params=query_params, headers=headers, auth=auth, timeout=self.timeout)
elif method == "DELETE":
return requests.delete(url, params=query_params, headers=headers, auth=auth, timeout=self.timeout)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
|
(self, method, url, query_params=None, headers=None, body=None)
|
69,001 |
mailchimp_marketing.api_client
|
set_config
| null |
def set_config(self, config = {}):
# Basic Auth
self.api_key = config['api_key'] if 'api_key' in config.keys() else ''
self.is_basic_auth = self.api_key != ''
# OAuth
self.access_token = config['access_token'] if 'access_token' in config.keys() else ''
self.is_oauth = self.access_token != ''
# If using Basic auth and no server is provided,
# attempt to extract it from the api_key directly.
self.server = config['server'] if 'server' in config.keys() else 'invalid-server'
if self.server == 'invalid-server' and self.is_basic_auth:
self.server = self.get_server_from_api_key(self.api_key)
self.timeout = config['timeout'] if 'timeout' in config.keys() else 120
|
(self, config={})
|
69,002 |
mailchimp_marketing.api.authorized_apps_api
|
AuthorizedAppsApi
|
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
|
class AuthorizedAppsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client):
self.api_client = api_client
def list(self, **kwargs): # noqa: E501
"""List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_with_http_info(**kwargs) # noqa: E501
return data
def list_with_http_info(self, **kwargs): # noqa: E501
"""List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['fields', 'exclude_fields', 'count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/authorized-apps', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2002', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get(self, app_id, **kwargs): # noqa: E501
"""Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_with_http_info(app_id, **kwargs) # noqa: E501
else:
(data) = self.get_with_http_info(app_id, **kwargs) # noqa: E501
return data
def get_with_http_info(self, app_id, **kwargs): # noqa: E501
"""Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['app_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'app_id' is set
if ('app_id' not in params or
params['app_id'] is None):
raise ValueError("Missing the required parameter `app_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'app_id' in params:
path_params['app_id'] = params['app_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/authorized-apps/{app_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2002Apps', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(api_client)
|
69,004 |
mailchimp_marketing.api.authorized_apps_api
|
get
|
Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
|
def get(self, app_id, **kwargs): # noqa: E501
"""Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_with_http_info(app_id, **kwargs) # noqa: E501
else:
(data) = self.get_with_http_info(app_id, **kwargs) # noqa: E501
return data
|
(self, app_id, **kwargs)
|
69,005 |
mailchimp_marketing.api.authorized_apps_api
|
get_with_http_info
|
Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
|
def get_with_http_info(self, app_id, **kwargs): # noqa: E501
"""Get authorized app info # noqa: E501
Get information about a specific authorized application. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(app_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str app_id: The unique id for the connected authorized application. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: InlineResponse2002Apps
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['app_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'app_id' is set
if ('app_id' not in params or
params['app_id'] is None):
raise ValueError("Missing the required parameter `app_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'app_id' in params:
path_params['app_id'] = params['app_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/authorized-apps/{app_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2002Apps', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, app_id, **kwargs)
|
69,006 |
mailchimp_marketing.api.authorized_apps_api
|
list
|
List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
|
def list(self, **kwargs): # noqa: E501
"""List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_with_http_info(**kwargs) # noqa: E501
return data
|
(self, **kwargs)
|
69,007 |
mailchimp_marketing.api.authorized_apps_api
|
list_with_http_info
|
List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
|
def list_with_http_info(self, **kwargs): # noqa: E501
"""List authorized apps # noqa: E501
Get a list of an account's registered, connected applications. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:return: InlineResponse2002
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['fields', 'exclude_fields', 'count', 'offset'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/authorized-apps', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2002', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, **kwargs)
|
69,008 |
mailchimp_marketing.api.automations_api
|
AutomationsApi
|
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
|
class AutomationsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client):
self.api_client = api_client
def archive(self, workflow_id, **kwargs): # noqa: E501
"""Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.archive_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.archive_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def archive_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method archive" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/actions/archive', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
def delete_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list(self, **kwargs): # noqa: E501
"""List automations # noqa: E501
Get a summary of an account's classic automations. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param datetime before_create_time: Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_create_time: Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime before_start_time: Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_start_time: Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param str status: Restrict the results to automations with the specified status.
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_with_http_info(**kwargs) # noqa: E501
return data
def list_with_http_info(self, **kwargs): # noqa: E501
"""List automations # noqa: E501
Get a summary of an account's classic automations. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param datetime before_create_time: Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_create_time: Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime before_start_time: Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_start_time: Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param str status: Restrict the results to automations with the specified status.
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['count', 'offset', 'fields', 'exclude_fields', 'before_create_time', 'since_create_time', 'before_start_time', 'since_start_time', 'status'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list" % key
)
params[key] = val
del params['kwargs']
if 'count' in params and params['count'] > 1000: # noqa: E501
raise ValueError("Invalid value for parameter `count` when calling ``, must be a value less than or equal to `1000`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'count' in params:
query_params.append(('count', params['count'])) # noqa: E501
if 'offset' in params:
query_params.append(('offset', params['offset'])) # noqa: E501
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
if 'before_create_time' in params:
query_params.append(('before_create_time', params['before_create_time'])) # noqa: E501
if 'since_create_time' in params:
query_params.append(('since_create_time', params['since_create_time'])) # noqa: E501
if 'before_start_time' in params:
query_params.append(('before_start_time', params['before_start_time'])) # noqa: E501
if 'since_start_time' in params:
query_params.append(('since_start_time', params['since_start_time'])) # noqa: E501
if 'status' in params:
query_params.append(('status', params['status'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2003', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get(self, workflow_id, **kwargs): # noqa: E501
"""Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.get_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def get_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_all_workflow_emails(self, workflow_id, **kwargs): # noqa: E501
"""List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_all_workflow_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.list_all_workflow_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def list_all_workflow_emails_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_all_workflow_emails" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationEmails', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
def get_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflowEmail', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workflow_email_subscriber_queue(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
def get_workflow_email_subscriber_queue_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email_subscriber_queue" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2004', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workflow_email_subscriber(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs): # noqa: E501
"""Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, **kwargs) # noqa: E501
return data
def get_workflow_email_subscriber_with_http_info(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs): # noqa: E501
"""Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id', 'subscriber_hash'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
# verify the required parameter 'subscriber_hash' is set
if ('subscriber_hash' not in params or
params['subscriber_hash'] is None):
raise ValueError("Missing the required parameter `subscriber_hash` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
if 'subscriber_hash' in params:
path_params['subscriber_hash'] = params['subscriber_hash'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberInAutomationQueue2', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_workflow_email_subscribers_removed(self, workflow_id, **kwargs): # noqa: E501
"""List subscribers removed from workflow # noqa: E501
Get information about subscribers who were removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_workflow_email_subscribers_removed(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: RemovedSubscribers
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_workflow_email_subscribers_removed_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.list_workflow_email_subscribers_removed_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def list_workflow_email_subscribers_removed_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""List subscribers removed from workflow # noqa: E501
Get information about subscribers who were removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_workflow_email_subscribers_removed_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: RemovedSubscribers
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_workflow_email_subscribers_removed" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/removed-subscribers', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='RemovedSubscribers', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_removed_workflow_email_subscriber(self, workflow_id, subscriber_hash, **kwargs): # noqa: E501
"""Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, **kwargs) # noqa: E501
else:
(data) = self.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, **kwargs) # noqa: E501
return data
def get_removed_workflow_email_subscriber_with_http_info(self, workflow_id, subscriber_hash, **kwargs): # noqa: E501
"""Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'subscriber_hash'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_removed_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'subscriber_hash' is set
if ('subscriber_hash' not in params or
params['subscriber_hash'] is None):
raise ValueError("Missing the required parameter `subscriber_hash` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'subscriber_hash' in params:
path_params['subscriber_hash'] = params['subscriber_hash'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/removed-subscribers/{subscriber_hash}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberRemovedFromAutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_workflow_email(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Update workflow email # noqa: E501
Update settings for a classic automation workflow email. Only works with workflows of type: abandonedBrowse, abandonedCart, emailFollowup, or singleWelcome. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workflow_email(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param UpdateInformationAboutASpecificWorkflowEmail body: (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.update_workflow_email_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
else:
(data) = self.update_workflow_email_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
return data
def update_workflow_email_with_http_info(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Update workflow email # noqa: E501
Update settings for a classic automation workflow email. Only works with workflows of type: abandonedBrowse, abandonedCart, emailFollowup, or singleWelcome. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workflow_email_with_http_info(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param UpdateInformationAboutASpecificWorkflowEmail body: (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflowEmail', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create(self, body, **kwargs): # noqa: E501
"""Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_with_http_info(body, **kwargs) # noqa: E501
return data
def create_with_http_info(self, body, **kwargs): # noqa: E501
"""Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def pause_all_emails(self, workflow_id, **kwargs): # noqa: E501
"""Pause automation emails # noqa: E501
Pause all emails in a specific classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pause_all_emails(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.pause_all_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.pause_all_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def pause_all_emails_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Pause automation emails # noqa: E501
Pause all emails in a specific classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pause_all_emails_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method pause_all_emails" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/actions/pause-all-emails', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def start_all_emails(self, workflow_id, **kwargs): # noqa: E501
"""Start automation emails # noqa: E501
Start all emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.start_all_emails(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.start_all_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.start_all_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
def start_all_emails_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Start automation emails # noqa: E501
Start all emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.start_all_emails_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method start_all_emails" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/actions/start-all-emails', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def pause_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Pause automated email # noqa: E501
Pause an automated email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pause_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.pause_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.pause_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
def pause_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Pause automated email # noqa: E501
Pause an automated email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pause_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method pause_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/actions/pause', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def start_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Start automated email # noqa: E501
Start an automated email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.start_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.start_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.start_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
def start_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Start automated email # noqa: E501
Start an automated email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.start_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method start_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/actions/start', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_workflow_email_subscriber(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
else:
(data) = self.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
return data
def add_workflow_email_subscriber_with_http_info(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberInAutomationQueue2', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_workflow_email_subscriber(self, workflow_id, body, **kwargs): # noqa: E501
"""Remove subscriber from workflow # noqa: E501
Remove a subscriber from a specific classic automation workflow. You can remove a subscriber at any point in an automation workflow, regardless of how many emails they've been sent from that workflow. Once they're removed, they can never be added back to the same workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_workflow_email_subscriber(workflow_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param SubscriberInAutomationQueue3 body: (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.remove_workflow_email_subscriber_with_http_info(workflow_id, body, **kwargs) # noqa: E501
else:
(data) = self.remove_workflow_email_subscriber_with_http_info(workflow_id, body, **kwargs) # noqa: E501
return data
def remove_workflow_email_subscriber_with_http_info(self, workflow_id, body, **kwargs): # noqa: E501
"""Remove subscriber from workflow # noqa: E501
Remove a subscriber from a specific classic automation workflow. You can remove a subscriber at any point in an automation workflow, regardless of how many emails they've been sent from that workflow. Once they're removed, they can never be added back to the same workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_workflow_email_subscriber_with_http_info(workflow_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param SubscriberInAutomationQueue3 body: (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/removed-subscribers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberRemovedFromAutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(api_client)
|
69,010 |
mailchimp_marketing.api.automations_api
|
add_workflow_email_subscriber
|
Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
|
def add_workflow_email_subscriber(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
else:
(data) = self.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, **kwargs) # noqa: E501
return data
|
(self, workflow_id, workflow_email_id, body, **kwargs)
|
69,011 |
mailchimp_marketing.api.automations_api
|
add_workflow_email_subscriber_with_http_info
|
Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
|
def add_workflow_email_subscriber_with_http_info(self, workflow_id, workflow_email_id, body, **kwargs): # noqa: E501
"""Add subscriber to workflow email # noqa: E501
Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param SubscriberInAutomationQueue1 body: (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberInAutomationQueue2', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, workflow_email_id, body, **kwargs)
|
69,012 |
mailchimp_marketing.api.automations_api
|
archive
|
Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
|
def archive(self, workflow_id, **kwargs): # noqa: E501
"""Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.archive_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.archive_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, **kwargs)
|
69,013 |
mailchimp_marketing.api.automations_api
|
archive_with_http_info
|
Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
|
def archive_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Archive automation # noqa: E501
Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method archive" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/actions/archive', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, **kwargs)
|
69,014 |
mailchimp_marketing.api.automations_api
|
create
|
Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def create(self, body, **kwargs): # noqa: E501
"""Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_with_http_info(body, **kwargs) # noqa: E501
return data
|
(self, body, **kwargs)
|
69,015 |
mailchimp_marketing.api.automations_api
|
create_with_http_info
|
Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def create_with_http_info(self, body, **kwargs): # noqa: E501
"""Add automation # noqa: E501
Create a new classic automation in your Mailchimp account. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AutomationWorkflow1 body: (required)
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, body, **kwargs)
|
69,016 |
mailchimp_marketing.api.automations_api
|
delete_workflow_email
|
Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
|
def delete_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,017 |
mailchimp_marketing.api.automations_api
|
delete_workflow_email_with_http_info
|
Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
|
def delete_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Delete workflow email # noqa: E501
Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,018 |
mailchimp_marketing.api.automations_api
|
get
|
Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def get(self, workflow_id, **kwargs): # noqa: E501
"""Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.get_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, **kwargs)
|
69,019 |
mailchimp_marketing.api.automations_api
|
get_removed_workflow_email_subscriber
|
Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def get_removed_workflow_email_subscriber(self, workflow_id, subscriber_hash, **kwargs): # noqa: E501
"""Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, **kwargs) # noqa: E501
else:
(data) = self.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, **kwargs) # noqa: E501
return data
|
(self, workflow_id, subscriber_hash, **kwargs)
|
69,020 |
mailchimp_marketing.api.automations_api
|
get_removed_workflow_email_subscriber_with_http_info
|
Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def get_removed_workflow_email_subscriber_with_http_info(self, workflow_id, subscriber_hash, **kwargs): # noqa: E501
"""Get subscriber removed from workflow # noqa: E501
Get information about a specific subscriber who was removed from a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_removed_workflow_email_subscriber_with_http_info(workflow_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberRemovedFromAutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'subscriber_hash'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_removed_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'subscriber_hash' is set
if ('subscriber_hash' not in params or
params['subscriber_hash'] is None):
raise ValueError("Missing the required parameter `subscriber_hash` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'subscriber_hash' in params:
path_params['subscriber_hash'] = params['subscriber_hash'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/removed-subscribers/{subscriber_hash}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberRemovedFromAutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, subscriber_hash, **kwargs)
|
69,021 |
mailchimp_marketing.api.automations_api
|
get_with_http_info
|
Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
|
def get_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""Get automation info # noqa: E501
Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:return: AutomationWorkflow
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'fields', 'exclude_fields'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields'])) # noqa: E501
collection_formats['fields'] = 'csv' # noqa: E501
if 'exclude_fields' in params:
query_params.append(('exclude_fields', params['exclude_fields'])) # noqa: E501
collection_formats['exclude_fields'] = 'csv' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflow', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, **kwargs)
|
69,022 |
mailchimp_marketing.api.automations_api
|
get_workflow_email
|
Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,023 |
mailchimp_marketing.api.automations_api
|
get_workflow_email_subscriber
|
Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email_subscriber(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs): # noqa: E501
"""Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, **kwargs) # noqa: E501
return data
|
(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs)
|
69,024 |
mailchimp_marketing.api.automations_api
|
get_workflow_email_subscriber_queue
|
List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email_subscriber_queue(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
else:
(data) = self.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,025 |
mailchimp_marketing.api.automations_api
|
get_workflow_email_subscriber_queue_with_http_info
|
List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email_subscriber_queue_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""List automated email subscribers # noqa: E501
Get information about a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_queue_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: InlineResponse2004
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email_subscriber_queue" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2004', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,026 |
mailchimp_marketing.api.automations_api
|
get_workflow_email_subscriber_with_http_info
|
Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email_subscriber_with_http_info(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs): # noqa: E501
"""Get automated email subscriber # noqa: E501
Get information about a specific subscriber in a classic automation email queue. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_subscriber_with_http_info(workflow_id, workflow_email_id, subscriber_hash, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:param str subscriber_hash: The MD5 hash of the lowercase version of the list member's email address. (required)
:return: SubscriberInAutomationQueue2
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id', 'subscriber_hash'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email_subscriber" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
# verify the required parameter 'subscriber_hash' is set
if ('subscriber_hash' not in params or
params['subscriber_hash'] is None):
raise ValueError("Missing the required parameter `subscriber_hash` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
if 'subscriber_hash' in params:
path_params['subscriber_hash'] = params['subscriber_hash'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubscriberInAutomationQueue2', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, workflow_email_id, subscriber_hash, **kwargs)
|
69,027 |
mailchimp_marketing.api.automations_api
|
get_workflow_email_with_http_info
|
Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
|
def get_workflow_email_with_http_info(self, workflow_id, workflow_email_id, **kwargs): # noqa: E501
"""Get workflow email info # noqa: E501
Get information about an individual classic automation workflow email. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workflow_email_with_http_info(workflow_id, workflow_email_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:param str workflow_email_id: The unique id for the Automation workflow email. (required)
:return: AutomationWorkflowEmail
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id', 'workflow_email_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workflow_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
# verify the required parameter 'workflow_email_id' is set
if ('workflow_email_id' not in params or
params['workflow_email_id'] is None):
raise ValueError("Missing the required parameter `workflow_email_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
if 'workflow_email_id' in params:
path_params['workflow_email_id'] = params['workflow_email_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationWorkflowEmail', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, workflow_email_id, **kwargs)
|
69,028 |
mailchimp_marketing.api.automations_api
|
list
|
List automations # noqa: E501
Get a summary of an account's classic automations. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param datetime before_create_time: Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_create_time: Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime before_start_time: Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_start_time: Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param str status: Restrict the results to automations with the specified status.
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
|
def list(self, **kwargs): # noqa: E501
"""List automations # noqa: E501
Get a summary of an account's classic automations. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int count: The number of records to return. Default value is 10. Maximum value is 1000
:param int offset: Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0.
:param list[str] fields: A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
:param list[str] exclude_fields: A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
:param datetime before_create_time: Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_create_time: Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime before_start_time: Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param datetime since_start_time: Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
:param str status: Restrict the results to automations with the specified status.
:return: InlineResponse2003
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_with_http_info(**kwargs) # noqa: E501
return data
|
(self, **kwargs)
|
69,029 |
mailchimp_marketing.api.automations_api
|
list_all_workflow_emails
|
List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
|
def list_all_workflow_emails(self, workflow_id, **kwargs): # noqa: E501
"""List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_all_workflow_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
else:
(data) = self.list_all_workflow_emails_with_http_info(workflow_id, **kwargs) # noqa: E501
return data
|
(self, workflow_id, **kwargs)
|
69,030 |
mailchimp_marketing.api.automations_api
|
list_all_workflow_emails_with_http_info
|
List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
|
def list_all_workflow_emails_with_http_info(self, workflow_id, **kwargs): # noqa: E501
"""List automated emails # noqa: E501
Get a summary of the emails in a classic automation workflow. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_all_workflow_emails_with_http_info(workflow_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workflow_id: The unique id for the Automation workflow. (required)
:return: AutomationEmails
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['workflow_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_all_workflow_emails" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workflow_id' is set
if ('workflow_id' not in params or
params['workflow_id'] is None):
raise ValueError("Missing the required parameter `workflow_id` when calling ``") # noqa: E501
collection_formats = {}
path_params = {}
if 'workflow_id' in params:
path_params['workflow_id'] = params['workflow_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # noqa: E501
return self.api_client.call_api(
'/automations/{workflow_id}/emails', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AutomationEmails', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
(self, workflow_id, **kwargs)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.