Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alejandrogomezfrieiro/devto.py
Modern Dev.To API client built with aiohttp and pydantic
https://github.com/alejandrogomezfrieiro/devto.py
aiohttp api-client devto pydantic
Last synced: about 14 hours ago
JSON representation
Modern Dev.To API client built with aiohttp and pydantic
- Host: GitHub
- URL: https://github.com/alejandrogomezfrieiro/devto.py
- Owner: AlejandroGomezFrieiro
- Created: 2025-01-04T22:25:39.000Z (8 days ago)
- Default Branch: main
- Last Pushed: 2025-01-05T10:23:31.000Z (7 days ago)
- Last Synced: 2025-01-05T10:29:59.670Z (7 days ago)
- Topics: aiohttp, api-client, devto, pydantic
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# devto.py
`devto` is a modern Python API client for the Forem API V1, written with `aiohttp` and `pydantic`.
At the moment, functionality only allows one to query articles and publish/update an existing article.
## Installation
Currently there are no Pypi wheels, use
```bash
pip install git+https://github.com/AlejandroGomezFrieiro/devto_py.git
```## Usage
```python
from devto.client import DevtoClient
from devto.models import DevtoArticle
import asyncio# Get published articles
async def main():
async with DevtoClient() as client:
return await client.published_articles()
asyncio.run(main())async def publish_article(article):
async with DevtoClient(api_key = "") as client:
return await client.publish_article(article)
article = DevtoArticle(
title="title",
body_markdown="Article body"
)
asyncio.run(publish_article(article))async def edit_article(article):
async with DevtoClient(api_key = "") as client:
return await client.update_article(article)asyncio.run(edit_article(article))
```## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)