Skip to main content

A Python interface for HackMD API

Project description

Table of Contents

What's this

python-HackMD is a Python interface for HackMD API. Read the full docs on ReadTheDocs.

Getting Started

Prerequisites

Installation

pip install python-HackMD

Basic Usage

Let's create an API object before everything starts.

from PyHackMD import API
api = API('<token>')

User API

  1. Get user information
data = api.get_me()
print(data)

User Notes API

  1. Get a list of notes in the user's workspace
data = api.get_notes()
print(data)
  1. Get a note
# note_id can be obtained using get_notes()
data = api.get_note('<note_id>')
print(data)
  1. Create a note
data = api.create_note(
            title='New Note',
            content='blablabla',
            read_perm='signed_in',
            write_perm='owner',
            comment_perm='signed_in_users')
print(data)
  1. Update a note
# note_id can be obtained using get_notes()
data = api.update_note(
            '<note_id>',
            content='blablabla',
            read_perm='signed_in',
            write_perm='owner',
            comment_perm='signed_in_users')
print(data)
  1. Delete a note
# note_id can be obtained using get_notes()
data = api.delete_note('<note_id>')
print(data)
  1. Get a history of read notes
data = api.get_read_history()
print(data)

Teams API

  1. Get a list of the teams to which the user has permission
data = api.get_teams()
print(data)

Team Notes API

  1. Get a list of notes in a Team's workspace
# team_path can be obtained using get_teams()
data = api.get_team_notes('<team_path>')
print(data)
  1. Get a note in a Team's workspace
# note_id can be obtained using get_team_notes()
data = api.get_team_note('<note_id>')
print(data)
  1. Create a note in a Team workspace
# team_path can be obtained using get_teams()
data = api.create_team_note(
            '<team_path>'
            title='New Note',
            content='blablabla',
            read_perm='signed_in',
            write_perm='owner',
            comment_perm='signed_in_users')
print(data)
  1. Update a note in a Team's workspace
# team_path can be obtained using get_teams()
# note_id can be obtained using get_team_notes()
data = api.update_team_note(
            '<team_path>', '<note_id>',
            content='blablabla',
            read_perm='signed_in',
            write_perm='owner',
            comment_perm='signed_in_users')
print(data)
  1. Delete a note in a Team's workspace
# team_path can be obtained using get_teams()
# note_id can be obtained using get_team_notes()
data = api.delete_team_note('<team_path>', '<note_id>')
print(data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-HackMD-1.0.3.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

python_HackMD-1.0.3-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page