streamlit-cookies-controller API Reference
Full documentation for streamlit-cookies-controller (Standard Library / Native)
streamlit-cookies-controller.CookieController
Python Library Documentation: class CookieController in module streamlit_cookies_controller.cookie_controller
class CookieController(builtins.object)
| CookieController(key: str = 'cookies')
|
| Hook cookies get/set on Express for server-rendering
|
| Methods defined here:
|
| __init__(self, key: str = 'cookies')
| Initialize cookie controller
|
| ### Arguments
| key: str
| the session state key name to store the cookies
|
| get(self, name: str)
| Gets a cookie with the name
|
| ### Arguments
| name: str
| Name of the cookie
|
| ### Returns
| The value of the cookie with the given name
|
| getAll(self)
| Get all cookie for the domain
|
| ### Returns : dict[str, any]
| All client cookie for the site in dictionary
|
| refresh(self)
| Refresh the cookie cache located in streamlit session state with the actual browser cache
|
| remove(self, name: str, path: str = '/', domain: Optional[str] = None, secure: Optional[bool] = None, same_site: Union[bool, NoneType, Literal['lax', 'strict']] = 'strict', partitioned: Optional[bool] = None)
| Remove the cookie with the given name
|
| ### Arguments
| name: str
| Name of the cookie
| path: str
| Cookie path, use '/' as the path if you want your cookie to be accessible on all pages
| domain: str | None
| Domain for the cookie (sub.domain.com or .allsubdomains.com)
| secure: bool | None
| Is only accessible through HTTPS?
| sameSite: bool | None | 'strict' | 'lax'
| Strict or Lax enforcement
| partitioned: bool
| Indicates that the cookie should be stored using partitioned storage
|
| set(self, name: str, value: Any, path: str = '/', expires: Optional[datetime.datetime] = None, max_age: Optional[float] = None, domain: Optional[str] = None, secure: Optional[bool] = None, same_site: Union[bool, NoneType, Literal['lax', 'strict']] = 'strict', partitioned: Optional[bool] = None)
| Sets given `value` to cookie with given name
|
| ### Arguments
| name: str
| Name of the cookie
| value: any
| Value of the cookie
| path: str
| Cookie path, use '/' as the path if you want your cookie to be accessible on all pages
| expires: datetime | None
| Absolute expiration date for the cookie. If `None` or default, it will be a day from now.
| max_age: float | None
| Relative maximum age of the cookie from the client receives it in seconds.
| domain: str | None
| Domain for the cookie (sub.domain.com or .allsubdomains.com)
| secure: bool | None
| Is only accessible through HTTPS?
| sameSite: bool | None | 'strict' | 'lax'
| Strict or Lax enforcement
| partitioned: bool
| Indicates that the cookie should be stored using partitioned storage
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_CookieController__cookies': typing.Dict[str, typi...
streamlit-cookies-controller.RemoveEmptyElementContainer
Python Library Documentation: function RemoveEmptyElementContainer in module streamlit_cookies_controller.utils RemoveEmptyElementContainer()
streamlit-cookies-controller.cookie_controller
Python Library Documentation: module streamlit_cookies_controller.cookie_controller in streamlit_cookies_controller
NAME
streamlit_cookies_controller.cookie_controller
DESCRIPTION
# Author : Nathan Chen
# Date : 08-Mar-2024
CLASSES
builtins.object
CookieController
class CookieController(builtins.object)
| CookieController(key: str = 'cookies')
|
| Hook cookies get/set on Express for server-rendering
|
| Methods defined here:
|
| __init__(self, key: str = 'cookies')
| Initialize cookie controller
|
| ### Arguments
| key: str
| the session state key name to store the cookies
|
| get(self, name: str)
| Gets a cookie with the name
|
| ### Arguments
| name: str
| Name of the cookie
|
| ### Returns
| The value of the cookie with the given name
|
| getAll(self)
| Get all cookie for the domain
|
| ### Returns : dict[str, any]
| All client cookie for the site in dictionary
|
| refresh(self)
| Refresh the cookie cache located in streamlit session state with the actual browser cache
|
| remove(self, name: str, path: str = '/', domain: Optional[str] = None, secure: Optional[bool] = None, same_site: Union[bool, NoneType, Literal['lax', 'strict']] = 'strict', partitioned: Optional[bool] = None)
| Remove the cookie with the given name
|
| ### Arguments
| name: str
| Name of the cookie
| path: str
| Cookie path, use '/' as the path if you want your cookie to be accessible on all pages
| domain: str | None
| Domain for the cookie (sub.domain.com or .allsubdomains.com)
| secure: bool | None
| Is only accessible through HTTPS?
| sameSite: bool | None | 'strict' | 'lax'
| Strict or Lax enforcement
| partitioned: bool
| Indicates that the cookie should be stored using partitioned storage
|
| set(self, name: str, value: Any, path: str = '/', expires: Optional[datetime.datetime] = None, max_age: Optional[float] = None, domain: Optional[str] = None, secure: Optional[bool] = None, same_site: Union[bool, NoneType, Literal['lax', 'strict']] = 'strict', partitioned: Optional[bool] = None)
| Sets given `value` to cookie with given name
|
| ### Arguments
| name: str
| Name of the cookie
| value: any
| Value of the cookie
| path: str
| Cookie path, use '/' as the path if you want your cookie to be accessible on all pages
| expires: datetime | None
| Absolute expiration date for the cookie. If `None` or default, it will be a day from now.
| max_age: float | None
| Relative maximum age of the cookie from the client receives it in seconds.
| domain: str | None
| Domain for the cookie (sub.domain.com or .allsubdomains.com)
| secure: bool | None
| Is only accessible through HTTPS?
| sameSite: bool | None | 'strict' | 'lax'
| Strict or Lax enforcement
| partitioned: bool
| Indicates that the cookie should be stored using partitioned storage
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_CookieController__cookies': typing.Dict[str, typi...
DATA
Dict = typing.Dict
A generic version of dict.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
build_dir = r'C:\Users\Youse\AppData\Local\Programs\Python\Pyt...kages...
parent_dir = r'C:\Users\Youse\AppData\Local\Programs\Python\Pyt...12\L...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\streamlit_cookies_controller\cookie_controller.py
streamlit-cookies-controller.utils
Python Library Documentation: module streamlit_cookies_controller.utils in streamlit_cookies_controller
NAME
streamlit_cookies_controller.utils
DESCRIPTION
# Author : Nathan Chen
# Date : 08-Mar-2024
FUNCTIONS
RemoveEmptyElementContainer()
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\streamlit_cookies_controller\utils.py