Skip to main content

PyDevTo

Unofficial dev.to api for python.

Features

  • Implements all endpoints from https://docs.dev.to/api/
  • Implements a few other api endpoints not documented but available in the source, such as users and follow_suggestions
  • Includes a helper method to convert html to dev.to specific markdown, including support for dev.to specific embeds such as YouTube.

Installation

Use the package manager pip to install pydevto.

pip install pydevto

Usage

Make sure you have an api key to use the authenticated endpoints. You can get your key from https://dev.to/settings/account (You can use pydevto without an api key for some functions, such as the public articles)

import pydevto
api = pydevto.PyDevTo(api_key='MY_KEY')
api.articles()  # returns list of your own published articles

Methods

import pydevto
api = pydevto.PyDevTo(api_key='MY_KEY')
api.public_articles(page=None, tag=None, username=None, state=None, top=None)  # Return list of public (published) articles
api.public_article(id)  # Return a single public (published) article given its id
api.articles(page=None, per_page=None, state="published")  # Return a list of user articles
api.create_article(...)  # Create an article
api.update_article(id, ...)  # Update an article
api.user(id=None, username=None)  # Return user information
api.follow_suggestions(page=None)  # Return list of follow suggestions
api.tags(page=None)  # Return list of tags
api.webhooks()  # Return list of webhooks
api.webhook(id)  # Return single webhook with id
api.create_webhook(source, target_url, events)  # Create a new webhook
api.delete_webhook(id)  # Delete  a webhook with id

Html to Markdown

PyDevTo contains a helper function to convert html to dev.to specific markdown (https://dev.to/p/editor_guide) It supports images with captions using the HTML figcaption tag, and converts embeds such as YouTube to dev.to specific liquid tags.

>>> import pydevto
>>> pydevto.html_to_markdown('<h1>Heading</h1') 
>>> '# Heading\n\n'
>>> pydevto.html_to_markdown('<iframe src="https://www.youtube.com/embed/kmjiUVEMvI4"></iframe>') 
>>> '\n{% youtube kmjiUVEMvI4 %}\n'  

Known issues

  • The tags property does not currently work correctly when creating/updating an article. There is an open issue report on dev.to for this.
  • The html to markdown only caters for a subset of embeds (YouTube, Twitter, repl.it, soundcloud and a few more), more will be added over time.

Contributing

Pull requests and issue reports are welcome.

License

MIT

Metadata

Release files for pydevto 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydevto 0.1.5
File Size Uploaded Provenance
pydevto-0.1.5.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydevto 0.1.5
File Interpreter ABI Platform
pydevto-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / pydevto-0.1.5.tar.gz

Download URL pydevto-0.1.5.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
91137b0ccaf18af0897029151a09da0240bc65d7c17c240b77df75b8bcf2cb3c
BLAKE2b-256 checksum
How to use checksums
f07fb8ac5c40bb21579c7023ab191c3a2b2e39168432cb683d90340cd40b11ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.7.3 Windows/10

Release files / pydevto-0.1.5-py3-none-any.whl

Download URL pydevto-0.1.5-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bffef0f20d0f26cd01aa36219a2cd804a09b78c491915d6c43c844c9525598d5
BLAKE2b-256 checksum
How to use checksums
ba576be230a501752d151839b81311847c78d6bd570a7b6a78e4ff2fc0e663e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.7.3 Windows/10

Security for pydevto 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page