text_sharing
Class info¶
Re-exported classes¶
| Class | Module | Description |
|---|---|---|
| GistSharer | anyenv.text_sharing.github_gist | Share text via GitHub Gists. |
| OpenCodeSharer | anyenv.text_sharing.opencode | OpenCode text sharing service. |
| PasteRsSharer | anyenv.text_sharing.paste_rs | Share text via paste.rs. |
| PastebinSharer | anyenv.text_sharing.pastebin | Share text via Pastebin.com. |
| ShareResult | anyenv.text_sharing.base | Result of a text sharing operation. |
| ShittyCodingAgentSharer | anyenv.text_sharing.shittycodingagent | Share text via GitHub Gists with shittycodingagent.ai preview URL. |
| TextSharer | anyenv.text_sharing.base | Base class for text sharing services. |
🛈 DocStrings¶
Text sharing services for sharing content via paste services.
GistSharer
¶
Bases: TextSharer
Share text via GitHub Gists.
Source code in src/anyenv/text_sharing/github_gist.py
__init__
¶
share
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share content as a GitHub Gist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Filename for the gist (defaults to "shared.txt" or "shared.{syntax}") |
None
|
syntax
|
str | None
|
File extension hint (e.g. "py", "md") |
None
|
visibility
|
Visibility
|
"public" or "unlisted" (private not supported) |
'unlisted'
|
expires_in
|
int | None
|
Ignored (gists don't expire) |
None
|
OpenCodeSharer
¶
Bases: TextSharer
OpenCode text sharing service.
Creates fake sessions by generating UUIDs and syncing content via the share API. OpenCode doesn't validate session existence, allowing us to create ad-hoc shares.
Examples:
Share a simple string:
Share a conversation:
Source code in src/anyenv/text_sharing/opencode.py
__init__
¶
close
async
¶
delete_share
async
¶
delete_share(result: ShareResult) -> bool
Delete a shared session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ShareResult
|
The ShareResult containing session ID and secret |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if deletion was successful |
share
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share text content via OpenCode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Optional title for the shared content |
None
|
syntax
|
str | None
|
Syntax highlighting hint (ignored - OpenCode handles this) |
None
|
visibility
|
Visibility
|
Visibility level (ignored - OpenCode uses private shares) |
'unlisted'
|
expires_in
|
int | None
|
Expiration time (ignored - OpenCode doesn't support expiration) |
None
|
Returns:
| Type | Description |
|---|---|
ShareResult
|
ShareResult with OpenCode share URL |
Source code in src/anyenv/text_sharing/opencode.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
share_conversation
async
¶
share_conversation(
messages: list[Message],
*,
title: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share a structured conversation with multiple messages.
This allows sharing AI chat sessions, multi-turn conversations, or any structured dialogue with different roles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages
|
list[Message]
|
List of messages to share (must have at least one) |
required |
title
|
str | None
|
Optional title for the conversation |
None
|
visibility
|
Visibility
|
Visibility level (ignored - OpenCode uses private shares) |
'unlisted'
|
expires_in
|
int | None
|
Expiration time (ignored - OpenCode doesn't support expiration) |
None
|
Returns:
| Type | Description |
|---|---|
ShareResult
|
ShareResult with OpenCode share URL |
Example
Source code in src/anyenv/text_sharing/opencode.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
PasteRsSharer
¶
Bases: TextSharer
Share text via paste.rs.
Source code in src/anyenv/text_sharing/paste_rs.py
share
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share content on paste.rs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Ignored (paste.rs doesn't support titles) |
None
|
syntax
|
str | None
|
Used as file extension for syntax highlighting |
None
|
visibility
|
Visibility
|
Ignored (all pastes are unlisted) |
'unlisted'
|
expires_in
|
int | None
|
Ignored (paste.rs doesn't support expiration) |
None
|
PastebinSharer
¶
Bases: TextSharer
Share text via Pastebin.com.
Source code in src/anyenv/text_sharing/pastebin.py
__init__
¶
share
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share content on Pastebin.com.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Title/name of the paste |
None
|
syntax
|
str | None
|
Syntax highlighting (e.g. "python", "markdown", "javascript") |
None
|
visibility
|
Visibility
|
"public", "unlisted", or "private" |
'unlisted'
|
expires_in
|
int | None
|
Expiration time in seconds (rounded to nearest valid value) |
None
|
ShareResult
dataclass
¶
ShittyCodingAgentSharer
¶
Bases: TextSharer
Share text via GitHub Gists with shittycodingagent.ai preview URL.
Creates a secret (unlisted) GitHub Gist and returns a URL in the format: https://shittycodingagent.ai/session?{gist_id}
Source code in src/anyenv/text_sharing/shittycodingagent.py
__init__
¶
share
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share content via GitHub Gist with shittycodingagent.ai preview.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Filename for the gist (defaults to "session.html") |
None
|
syntax
|
str | None
|
File extension hint (e.g. "html") |
None
|
visibility
|
Visibility
|
Always creates unlisted gist (visibility param ignored) |
'unlisted'
|
expires_in
|
int | None
|
Ignored (gists don't expire) |
None
|
Returns:
| Type | Description |
|---|---|
ShareResult
|
ShareResult with shittycodingagent.ai preview URL |
TextSharer
¶
Bases: ABC
Base class for text sharing services.
Source code in src/anyenv/text_sharing/base.py
share
abstractmethod
async
¶
share(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
Share text content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text content to share |
required |
title
|
str | None
|
Optional title/filename for the content |
None
|
syntax
|
str | None
|
Syntax highlighting hint (e.g. "python", "markdown") |
None
|
visibility
|
Visibility
|
Visibility level (not all providers support all levels) |
'unlisted'
|
expires_in
|
int | None
|
Expiration time in seconds (not supported by all providers) |
None
|
Returns:
| Type | Description |
|---|---|
ShareResult
|
ShareResult with URL and metadata |
share_sync
¶
share_sync(
content: str,
*,
title: str | None = None,
syntax: str | None = None,
visibility: Visibility = "unlisted",
expires_in: int | None = None,
) -> ShareResult
get_sharer
¶
get_sharer(provider: Literal['gist'], *, token: str | None = None) -> GistSharer
get_sharer(provider: Literal['pastebin'], *, api_key: str | None = None) -> PastebinSharer
get_sharer(provider: Literal['paste_rs']) -> PasteRsSharer
get_sharer(provider: Literal['opencode'], *, api_url: str | None = None) -> OpenCodeSharer
get_sharer(
provider: Literal["shittycodingagent"], *, token: str | None = None
) -> ShittyCodingAgentSharer
get_sharer(provider: TextSharerStr, **kwargs: str | None) -> TextSharer
Get a text sharer based on provider name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
TextSharerStr
|
The text sharing provider to use |
required |
**kwargs
|
str | None
|
Keyword arguments to pass to the provider constructor |
{}
|
Returns:
| Type | Description |
|---|---|
TextSharer
|
An instance of the specified text sharer |
Example