Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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/)