diff --git a/cohost/__version__.py b/cohost/__version__.py index 6420a55..9386c73 100644 --- a/cohost/__version__.py +++ b/cohost/__version__.py @@ -7,7 +7,7 @@ __title__ = 'cohost' __description__ = 'Unofficial Python API for Cohost.org - the fourth website!' -__version__ = '0.2.0' +__version__ = '0.2.1' __author__ = 'Val Knight' __author_email__ = 'val@valknight.xyz' __license__ = 'MIT' diff --git a/demos/releaseNotes/0.2.1.py b/demos/releaseNotes/0.2.1.py new file mode 100644 index 0000000..93d2dee --- /dev/null +++ b/demos/releaseNotes/0.2.1.py @@ -0,0 +1,55 @@ +import os +from cohost.models.user import User +from cohost.models.block import AttachmentBlock, MarkdownBlock + +def generateWarningNote(message: str, title = "Heads up! :host-shock:"): + # stolen from https://cohost.org/aristurtle/post/176671-admonitions-on-cohos + return """
+

+ ⚠️ {} +

+

+ {} +

+
""".format(title, message) + +def generateDangerNote(message: str, title = "Danger!"): + # stolen from https://cohost.org/aristurtle/post/176671-admonitions-on-cohos + return """
+

+ 🔺 {} +

+

+ {} +

+
""".format(title, message) + +def main(): + username = os.environ.get('cohostUser') + password = os.environ.get('cohostPass') + handle = os.environ.get('cohostHandle') + if username is None: + username = input('username: ') + if password is None: + password = input('password: ') + if handle is None: + handle = input('handle: ') + blocks = [ + MarkdownBlock('
cohost.py 0.2.1 is out!!
'), + MarkdownBlock('''smaller release this time round, but, big news is we've now extended compatibility back to python 3.8 (and maybe older !!)'''), + MarkdownBlock('''notifications also now suck less, with pagified notification support (and everything doesn't catch fire if you delete a post you got a comment on)'''), + MarkdownBlock('''as always, install the library with `pip install cohost` - see below for code samples :)'''), + MarkdownBlock(generateWarningNote("Cohost.py is still experimental, and uses the private Cohost API! Please submit bugs, but, no promises of stability.")), + MarkdownBlock(generateDangerNote("If you're making a bot, please honor [@jkap's little notes on bots](https://cohost.org/jkap/post/201002-small-request-that-i)! And, as always, don't make this site awful :)")), + MarkdownBlock('
'), + MarkdownBlock('
as always, check out the script used to post this release note :)') + ] + # woah !!! logging in !!! that's so cool !!! + user = User.login(username, password) + project = user.getProject(handle) + newPost = project.post('new release of cohost.py for all your automated Chostin\'!', + blocks, tags=['cohost.py', 'python', 'development', 'cohost api'], draft=False) + print('Check out your post at {}'.format(newPost.url)) + +if __name__ == '__main__': + main() \ No newline at end of file