We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
is_hosted()
1 parent d3b5c45 commit e43d33cCopy full SHA for e43d33c
shiny/bookmark/_utils.py
@@ -0,0 +1,21 @@
1
+import os
2
+from typing import Any
3
+
4
+import orjson
5
6
7
+def is_hosted() -> bool:
8
+ # Can't look at SHINY_PORT, as we already set it in shiny/_main.py's `run_app()`
9
10
+ # TODO: Support shinyapps.io or use `SHINY_PORT` how R-shiny did
11
12
+ # Instead, looking for the presence of the environment variable that Connect sets
13
+ # (*_Connect) or Shiny Server sets (SHINY_APP)
14
+ for env_var in ("POSIT_CONNECT", "RSTUDIO_CONNECT", "SHINY_APP"):
15
+ if env_var in os.environ:
16
+ return True
17
+ return False
18
19
20
+def to_json(x: Any) -> dict[str, Any]:
21
+ return orjson.loads(orjson.dumps(x))
0 commit comments