PyHackMD package

class PyHackMD.api.API(token)

Bases: object

A Python interface of HackMD API

create_note(title: str, content: str = '', read_perm: str = 'signed_in', write_perm: str = 'owner', comment_perm: str = 'signed_in_users')

Create a personal note

Parameters
  • title (str) – title of the personal note

  • content (str) – content of the personal note

  • read_perm (str) – read permission of the personal note (‘owner’|’signed_in’|’guest’)

  • write_perm (str) – write permission of the personal note (‘owner’|’signed_in’|’guest’)

  • comment_perm (str) – comment permission of the personal note (‘disable’|’forbidden’|’owner’|’signed_in_users’|’everyone’)

Returns

dict on success, otherwise None

Return type

dict | None

create_team_note(team_path: str, title: str, content: str = '', read_perm: str = 'signed_in', write_perm: str = 'owner', comment_perm: str = 'signed_in_users')

Create a team note

Parameters
  • team_path (str) – team path, can be found using get_teams()

  • title (str) – title of the team note

  • content (str) – content of the team note

  • read_perm (str) – read permission of the team note (‘owner’|’signed_in’|’guest’)

  • write_perm (str) – write permission of the team note (‘owner’|’signed_in’|’guest’)

  • comment_perm (str) – comment permission of the team note (‘disable’|’forbidden’|’owner’|’signed_in_users’|’everyone’)

Returns

dict on success, otherwise None

Return type

dict | None

delete_note(note_id: str)

Delete a personal note

Parameters

note_id (str) – note ID, can be found using get_notes()

Returns

empty string on success, otherwise None

Return type

str | None

delete_team_note(team_path: str, note_id: str)

Delete a team note

Parameters
  • team_path (str) – team path, can be found using get_teams()

  • note_id (str) – note ID, can be found using get_team_notes()

Returns

empty string on success, otherwise None

Return type

str | None

get_me()

Get user information

Returns

dict on success, otherwise None

Return type

dict | None

get_note(note_id: str)

Get a personal note

Parameters

note_id (str) – note ID, can be found using get_notes()

Returns

dict on success, otherwise None

Return type

dict | None

get_notes()

Get the list of persoanl notes

Returns

dict on success, otherwise None

Return type

dict | None

get_read_history()

Get a history of read notes

Returns

dict on success, otherwise None

Return type

dict | None

get_team_note(note_id: str)

Get a team note

Parameters

note_id (str) – note ID, can be found using get_team_notes()

Returns

dict on success, otherwise None

Return type

dict | None

get_team_notes(team_path: str)

Get the list of team notes

Parameters

team_path (str) – team path, can be found using get_teams()

Returns

dict on success, otherwise None

Return type

dict | None

get_teams()

Get the list of teams to which the user has permission

Parameters

note_id (str) – note ID, can be found using get_notes()

Returns

dict on success, otherwise None

Return type

dict | None

update_note(note_id: str, content: Optional[str] = None, read_perm: Optional[str] = None, write_perm: Optional[str] = None, comment_perm: Optional[str] = None)

Update a personal note

Parameters
  • note_id (str) – note ID, can be found using get_notes()

  • content (str | None, optional) – content of the personal note

  • read_perm (str | None, optional) – read permission of the personal note (‘owner’|’signed_in’|’guest’)

  • write_perm (str | None, optional) – write permission of the personal note (‘owner’|’signed_in’|’guest’)

  • comment_perm (str | None, optional) – comment permission of the personal note (‘disable’|’forbidden’|’owner’|’signed_in_users’|’everyone’)

Returns

‘Accept’ on success, otherwise None

Return type

str | None

update_team_note(team_path: str, note_id: str, content: Optional[str] = None, read_perm: Optional[str] = None, write_perm: Optional[str] = None, comment_perm: Optional[str] = None)

Update a team note

Parameters
  • team_path (str) – team path, can be found using get_teams()

  • note_id (str) – note ID, can be found using get_team_notes()

  • content (str | None, optional) – content of the team note

  • read_perm (str | None, optional) – read permission of the team note (‘owner’|’signed_in’|’guest’)

  • write_perm (str | None, optional) – write permission of the team note (‘owner’|’signed_in’|’guest’)

  • comment_perm (str | None, optional) – comment permission of the team note (‘disable’|’forbidden’|’owner’|’signed_in_users’|’everyone’)

Returns

‘Accept’ on success, otherwise None

Return type

str | None