Skip to main content

Hashnode_Py

hashnode_py is a Python package designed to interact with the Hashnode GraphQL API. With this library, you have the ability to publish, update, or delete your articles and drafts. Additionally, it offers various functionalities to seamlessly interact with your publication directly from your code.

Features

  • Publish, Update, and Delete Articles/Drafts
  • Get your hashnode data including: posts, publications, followers, subscriptions and many more
  • Access your feed posts and apply filters

Installation

Install hashnode_py with pip

  pip install hashnode-py

Usage/Examples

First get your Hashnode Personal Access Token from here

Then jump in to your code

from hashnode_py import HashnodeClient

client = HashnodeClient("...ad0a")

Publish New Article

publication = client.get_publication("<YOUR_BLOG_DOMAIN_NAME>")

print(publication.publish_post(
            title="this is test title",
            content="this is a test content",
            tags_slug=[{"slug": "test", "name": "Test"}]
        ))

The message will be displayed indicating that the post has been successfully published, along with the post's ID.

Update The Article

post_id = "POST_ID"

print(publication.update_post(post_id=post_id, title="[UPDATE] this is test title"))

The message will be displayed indicating that the post has been successfully updated, along with the post's ID.

Delete The Article

print(publication.remove_post(post_id=post_id))

The message will be displayed indicating that the post has been successfully removed, along with the post's ID.

Publish Draft

draft = publication.get_drafts()[0]

print(publication.publish_draft(draft_id=draft.id))

The message will be displayed indicating that the draft has been successfully published, along with the post's ID.

License

MIT

Contributing

Contributions are always welcome!

Metadata

Release files for hashnode-py 0.0.1

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

Source distribution (sdist)

Source distribution for hashnode-py 0.0.1
File Size Uploaded Provenance
hashnode_py-0.0.1.tar.gz 14.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hashnode-py 0.0.1
File Interpreter ABI Platform
hashnode_py-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.4 kB

Release files / hashnode_py-0.0.1.tar.gz

Download URL hashnode_py-0.0.1.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
61609f20dbde6c884911f1288f904a0c3f47102702f6854f946f29bdbeb38956
BLAKE2b-256 checksum
How to use checksums
47028e710787b22394533c97d1d2a77a7b72db92ce8b9f583bae89811139734e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / hashnode_py-0.0.1-py3-none-any.whl

Download URL hashnode_py-0.0.1-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
783823d15efba45c56a3c1d085d5a2886fdc1037e5789b528e9ca234c03ce814
BLAKE2b-256 checksum
How to use checksums
e831085ea4d9badf848589e6c575c69ad544f18b38580dc7a59d53df01d22872
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for hashnode-py 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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