@@ -491,6 +491,84 @@ def stop_transmission(self):
491491 """
492492 raise Client .StopTransmission
493493
494+ def export_session_string (self ):
495+ """Export the current authorized session as a serialized string.
496+
497+ Session strings are useful for storing in-memory authorized sessions in a portable, serialized string.
498+ More detailed information about session strings can be found at the dedicated page of
499+ :doc:`Storage Engines <../../topics/storage-engines>`.
500+
501+ Has no parameters.
502+
503+ Returns:
504+ ``str``: The session serialized into a printable, url-safe string.
505+
506+ Example:
507+ .. code-block:: python
508+ :emphasize-lines: 6
509+
510+ from pyrogram import Client
511+
512+ app = Client("my_account")
513+
514+ with app:
515+ print(app.export_session_string())
516+ """
517+ return self .storage .export_session_string ()
518+
519+ def set_parse_mode (self , parse_mode : Union [str , None ] = "combined" ):
520+ """Set the parse mode to be used globally by the client.
521+
522+ When setting the parse mode with this method, all methods having a *parse_mode* parameter will follow the global
523+ value by default. The default value *"combined"* enables both Markdown and HTML styles to be used and combined
524+ together.
525+
526+ Parameters:
527+ parse_mode (``str``):
528+ The new parse mode, can be any of: *"combined"*, for the default combined mode. *"markdown"* or *"md"*
529+ to force Markdown-only styles. *"html"* to force HTML-only styles. *None* to disable the parser
530+ completely.
531+
532+ Raises:
533+ ValueError: In case the provided *parse_mode* is not a valid parse mode.
534+
535+ Example:
536+ .. code-block:: python
537+ :emphasize-lines: 10,14,18,22
538+
539+ from pyrogram import Client
540+
541+ app = Client("my_account")
542+
543+ with app:
544+ # Default combined mode: Markdown + HTML
545+ app.send_message("haskell", "1. **markdown** and <i>html</i>")
546+
547+ # Force Markdown-only, HTML is disabled
548+ app.set_parse_mode("markdown")
549+ app.send_message("haskell", "2. **markdown** and <i>html</i>")
550+
551+ # Force HTML-only, Markdown is disabled
552+ app.set_parse_mode("html")
553+ app.send_message("haskell", "3. **markdown** and <i>html</i>")
554+
555+ # Disable the parser completely
556+ app.set_parse_mode(None)
557+ app.send_message("haskell", "4. **markdown** and <i>html</i>")
558+
559+ # Bring back the default combined mode
560+ app.set_parse_mode()
561+ app.send_message("haskell", "5. **markdown** and <i>html</i>")
562+ """
563+
564+ if parse_mode not in self .PARSE_MODES :
565+ raise ValueError ('parse_mode must be one of {} or None. Not "{}"' .format (
566+ ", " .join ('"{}"' .format (m ) for m in self .PARSE_MODES [:- 1 ]),
567+ parse_mode
568+ ))
569+
570+ self .parse_mode = parse_mode
571+
494572 def authorize_bot (self ):
495573 try :
496574 r = self .send (
0 commit comments