Name | cohost JSON |
Version |
0.5.1
JSON |
| download |
home_page | None |
Summary | Unofficial Python API wrapper for Cohost.org - the fourth website! |
upload_time | 2024-08-14 21:26:07 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2022 Vallerie Knight Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
cohost.org
cohost
api
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Cohost.py
![Edit of Eggbug into the python logo](pybug_small.png)
A python library for Cohost!
## Hyperstart
> `pip install cohost`
## Quickstart
> `pip install cohost`
```python3
from cohost.models.user import User
from cohost.models.block import AttachmentBlock, MarkdownBlock
cookie = 'yourCookie'
user = User.loginWithCookie(cookie)
# Alternatively: use a username/password combo
# import os
# user = User.login(os.getenv("COHOST_USER"), os.getenv("COHOST_PASS"))
for project in user.editedProjects:
print(project) # Print all pages you have edit permissions for
project = user.getProject('vallerie') # will retrieve the page I have edit writes for with handle @vallerie
blocks = [
AttachmentBlock('pybug.png'), # References image file pybug.png
MarkdownBlock('**Hello from Python!**') # Example of markdown / text block
]
newPost = project.post('Title of python post!', blocks, tags=['cohost.py', 'python'])
print('Check out your post at {}'.format(newPost.url))
```
## Getting started
1. Have an activated Cohost.org account. This entire library will probably explode if you use it with an unactivated account, and it defo isn't some bypass.
2. Install library with `pip install cohost`
3. Log in with a cookie or a username/password
4. Import data models you require, and go from there!
## Terminology
Some things are different on the API, and on the UI, and for the most part this library will match the API's terminology. Some key concepts:
- A user is minimal - it will contain authentication, email, and some other key details but not much else
- All the pages you can edit are referred to as "projects"
- Each post is made up content "Blocks"
## Retrieving your cookie
One way to login is to use an authentication token for Cohost. This can be retrieved by:
1. Open Developer Tools in your browser
1. Go to "Storage"
1. Find the "Cookies" entry
1. Copy the data for "`connect.sid`".
1. Use this in the library
## What's working? (allegedly)
- Logging in as a user (using either a cookie or a username/password)
- Retrieving projects of a user (and of other people when you got a post to go with it)
- Retrieving posts of a page
- Posting to a page
- Attaching images to a post (with alt-text support!)
- Editing posts
- Retrieving notifications with pagination
## What's not done but needs to be done?
- Retrieving single posts - currently have to read entire projects
- Retrieving a project's drafts
- Retrieving a projects of others without a post inbetween
- Sharing posts (with comment)
- Editing profiles
- Deleting posts
- Likely a whole bunch of other things I haven't thought about
- Better docs
## What's not implemented intentionally?
Some features I intend not to add. These features aren't impossible to build, but, they could be detrimental to the Cohost experience for other users, send mass notifications without an account being activated, or pose security issues. This is designed to deter low effort malicious bots, to reduce the workload on Cohost's staff.
These include:
- Editing a user's password
- Accepting follow requests
- Sharing a post without a comment
- Creating new projects
If you implement these features, please keep them **private** for your projects.
If you think one of these should be implemented, please file a GitHub issue with your case as to why.
## Support Cohost
[Buy Cohost PLUS](https://cohost.org/rc/user/settings)
## Follow me on Cohost!
[hello is me](https://cohost.org/vallerie)
## Thanks
- [cohost.js](https://github.com/mogery/cohost.js/) - provided a good point to start looking at how to go about this, and how cohost works in fundamental aspects. also has a working login thing which i need to properly understand at some point
- [cohost.org](https://cohost.org) - home of eggbug
- [requests](https://requests.readthedocs.io/en/latest/) - i would be lost in python if it weren't for requests, my beloved
- the random tumblr anon who sent me an activation link - thanks
Raw data
{
"_id": null,
"home_page": null,
"name": "cohost",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Val Knight <val@valknight.xyz>",
"keywords": "cohost.org, cohost, api",
"author": null,
"author_email": "Val Knight <val@valknight.xyz>",
"download_url": "https://files.pythonhosted.org/packages/a2/be/376d32a79ac085dab3f55c8154cdf6ac331f577afbba8f8dfd058bb335b2/cohost-0.5.1.tar.gz",
"platform": null,
"description": "# Cohost.py\n\n![Edit of Eggbug into the python logo](pybug_small.png)\n\nA python library for Cohost!\n\n## Hyperstart\n\n> `pip install cohost`\n\n## Quickstart\n\n> `pip install cohost`\n\n```python3\nfrom cohost.models.user import User\nfrom cohost.models.block import AttachmentBlock, MarkdownBlock\n\ncookie = 'yourCookie'\nuser = User.loginWithCookie(cookie)\n# Alternatively: use a username/password combo\n# import os\n# user = User.login(os.getenv(\"COHOST_USER\"), os.getenv(\"COHOST_PASS\"))\n\nfor project in user.editedProjects:\n print(project) # Print all pages you have edit permissions for\nproject = user.getProject('vallerie') # will retrieve the page I have edit writes for with handle @vallerie\n\nblocks = [\n AttachmentBlock('pybug.png'), # References image file pybug.png\n MarkdownBlock('**Hello from Python!**') # Example of markdown / text block\n]\nnewPost = project.post('Title of python post!', blocks, tags=['cohost.py', 'python'])\nprint('Check out your post at {}'.format(newPost.url))\n```\n\n## Getting started\n\n1. Have an activated Cohost.org account. This entire library will probably explode if you use it with an unactivated account, and it defo isn't some bypass.\n2. Install library with `pip install cohost`\n3. Log in with a cookie or a username/password\n4. Import data models you require, and go from there!\n\n## Terminology\n\nSome things are different on the API, and on the UI, and for the most part this library will match the API's terminology. Some key concepts:\n\n- A user is minimal - it will contain authentication, email, and some other key details but not much else\n- All the pages you can edit are referred to as \"projects\"\n- Each post is made up content \"Blocks\"\n\n## Retrieving your cookie\n\nOne way to login is to use an authentication token for Cohost. This can be retrieved by:\n\n1. Open Developer Tools in your browser\n1. Go to \"Storage\"\n1. Find the \"Cookies\" entry\n1. Copy the data for \"`connect.sid`\".\n1. Use this in the library\n\n## What's working? (allegedly)\n\n- Logging in as a user (using either a cookie or a username/password)\n- Retrieving projects of a user (and of other people when you got a post to go with it)\n- Retrieving posts of a page\n- Posting to a page\n- Attaching images to a post (with alt-text support!)\n- Editing posts\n- Retrieving notifications with pagination\n\n## What's not done but needs to be done?\n\n- Retrieving single posts - currently have to read entire projects\n- Retrieving a project's drafts\n- Retrieving a projects of others without a post inbetween\n- Sharing posts (with comment)\n- Editing profiles\n- Deleting posts\n- Likely a whole bunch of other things I haven't thought about\n- Better docs\n\n## What's not implemented intentionally?\n\nSome features I intend not to add. These features aren't impossible to build, but, they could be detrimental to the Cohost experience for other users, send mass notifications without an account being activated, or pose security issues. This is designed to deter low effort malicious bots, to reduce the workload on Cohost's staff.\n\nThese include:\n\n- Editing a user's password\n- Accepting follow requests\n- Sharing a post without a comment\n- Creating new projects\n\nIf you implement these features, please keep them **private** for your projects.\nIf you think one of these should be implemented, please file a GitHub issue with your case as to why.\n\n## Support Cohost\n\n[Buy Cohost PLUS](https://cohost.org/rc/user/settings)\n\n## Follow me on Cohost!\n\n[hello is me](https://cohost.org/vallerie)\n\n## Thanks\n\n- [cohost.js](https://github.com/mogery/cohost.js/) - provided a good point to start looking at how to go about this, and how cohost works in fundamental aspects. also has a working login thing which i need to properly understand at some point\n- [cohost.org](https://cohost.org) - home of eggbug\n- [requests](https://requests.readthedocs.io/en/latest/) - i would be lost in python if it weren't for requests, my beloved\n- the random tumblr anon who sent me an activation link - thanks\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2022 Vallerie Knight Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Unofficial Python API wrapper for Cohost.org - the fourth website!",
"version": "0.5.1",
"project_urls": {
"repository": "https://github.com/valknight/cohost.py"
},
"split_keywords": [
"cohost.org",
" cohost",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "86dc13c1b5616dd30c61df527ca87d295d8b6dfcc0486cd521989580422cf161",
"md5": "d5f17d3c3b18e8aca688ce041badbda4",
"sha256": "0bbe22c113712697372043d008a4b22b0570e7dbb575eacf6641e4ef8b20ce25"
},
"downloads": -1,
"filename": "cohost-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d5f17d3c3b18e8aca688ce041badbda4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 17101,
"upload_time": "2024-08-14T21:26:05",
"upload_time_iso_8601": "2024-08-14T21:26:05.553509Z",
"url": "https://files.pythonhosted.org/packages/86/dc/13c1b5616dd30c61df527ca87d295d8b6dfcc0486cd521989580422cf161/cohost-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a2be376d32a79ac085dab3f55c8154cdf6ac331f577afbba8f8dfd058bb335b2",
"md5": "6015f5140c9e4a0c48b898e4cd697ca0",
"sha256": "69152549e3e4a77b3f315f4d5f816e524f57f9e09415bd0c17f00978ab14f5f9"
},
"downloads": -1,
"filename": "cohost-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "6015f5140c9e4a0c48b898e4cd697ca0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16549,
"upload_time": "2024-08-14T21:26:07",
"upload_time_iso_8601": "2024-08-14T21:26:07.437418Z",
"url": "https://files.pythonhosted.org/packages/a2/be/376d32a79ac085dab3f55c8154cdf6ac331f577afbba8f8dfd058bb335b2/cohost-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-14 21:26:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "valknight",
"github_project": "cohost.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cohost"
}