hackmd-sdk-python

Type-safe python SDK for HackMD developer


Keywords
Hackmd
License
MIT
Install
pip install hackmd-sdk-python==0.2.0

Documentation

HackMD Python SDK

License: MIT PRs Welcome Python Version

It is a Type-safe Python SDK that can let your HackMD development fastly.

Usage

pip install hackmd-sdk-python

# or

python setup.py install

Get Me example

from hackmd.client import Hackmd

hack = Hackmd(token="YOUR_TOKEN")
me = hack.get_me()

print(me.teams[0].name)  # Your team name
print(me.name)           # Your HackMD name

Create Note example

from hackmd.client import Hackmd
from hackmd.typing.notes import NoteCreate

hack = Hackmd(token="YOUR_TOKEN")
note = NoteCreate(**{
    'title': 'New Post',
    'content': 'I am Content',
    'read_permission': 'owner',
    'write_permission': 'owner',
    'comment_permission': 'everyone',

})
result = hack.create_note(body=note)
print(result)

Methods

Authentication: X-HackMD-API-Version: 1.0.0

User

  • get_me()
    • return: Me()

User Note

  • get_notes()
    • return: List[Notes]
  • get_note(note_id=note_id)
    • return: Note()
  • create_note(body=NoteCreate())
    • return: Note()
  • update_note(note_id=note_id, body=NoteUpdate())
    • return: Note()
  • delete_note(note_id=note_id)
    • return: ''
  • get_read_notes_history()
    • return: List[Notes]

Development

git clone
cd hackmd-sdk-python/
pythom -m pytest tests/

License

MIT