python-HackMD


Namepython-HackMD JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/eugene87222/python-HackMD
SummaryA Python interface for HackMD API
upload_time2024-05-10 15:42:26
maintainerNone
docs_urlNone
authorEugene Yang
requires_pythonNone
licenseMIT
keywords hackmd api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Table of Contents
- [What's this](#whats-this)
- [Getting Started](#getting-started)
    - [Prerequisites](#prerequisites)
    - [Installation](#installation)
    - [Basic Usage](#bacis-usage)
        - [User API](#user-api)
        - [User Notes API](#user-notes-api)
        - [Teams API](#teams-api)
        - [Team Notes API](#team-notes-api)

# What's this

`python-HackMD` is a Python interface for HackMD API. Read the full docs on [ReadTheDocs](https://python-hackmd.readthedocs.io/en/latest/).

# Getting Started

## Prerequisites

- Python 3.6+
- HackMD API token ([How to create a token](https://hackmd.io/@hackmd-api/how-to-issue-an-api-token))

## Installation

```shell
pip install python-HackMD
```

## Basic Usage

Let's create an API object before everything starts.

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

### User API

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

### User Notes API

1. Get a list of notes in the user's workspace
```python
data = api.get_notes()
print(data)
```

2. Get a note
```python
# note_id can be obtained using get_notes()
data = api.get_note('<note_id>')
print(data)
```

3. Create a note
```python
data = api.create_note(
            title='New Note',
            content='blablabla',
            read_perm='signed_in',
            write_perm='owner',
            comment_perm='signed_in_users')
print(data)
```

4. Update a note
```python
# 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)
```

5. Delete a note
```python
# note_id can be obtained using get_notes()
data = api.delete_note('<note_id>')
print(data)
```

6. Get a history of read notes
```python
data = api.get_read_history()
print(data)
```

### Teams API

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

### Team Notes API

1. Get a list of notes in a Team's workspace
```python
# team_path can be obtained using get_teams()
data = api.get_team_notes('<team_path>')
print(data)
```

2. Get a note in a Team's workspace
```python
# note_id can be obtained using get_team_notes()
data = api.get_team_note('<note_id>')
print(data)
```

3. Create a note in a Team workspace
```python
# 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)
```

4. Update a note in a Team's workspace
```python
# 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)
```

5. Delete a note in a Team's workspace
```python
# 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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eugene87222/python-HackMD",
    "name": "python-HackMD",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "HackMD API",
    "author": "Eugene Yang",
    "author_email": "eugene87222@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a0/de/edccfc5f5f57fc27fbfdbb8d368920a6791e3c38a92cdd093f2f01dfaca4/python-HackMD-1.0.3.tar.gz",
    "platform": null,
    "description": "# Table of Contents\n- [What's this](#whats-this)\n- [Getting Started](#getting-started)\n    - [Prerequisites](#prerequisites)\n    - [Installation](#installation)\n    - [Basic Usage](#bacis-usage)\n        - [User API](#user-api)\n        - [User Notes API](#user-notes-api)\n        - [Teams API](#teams-api)\n        - [Team Notes API](#team-notes-api)\n\n# What's this\n\n`python-HackMD` is a Python interface for HackMD API. Read the full docs on [ReadTheDocs](https://python-hackmd.readthedocs.io/en/latest/).\n\n# Getting Started\n\n## Prerequisites\n\n- Python 3.6+\n- HackMD API token ([How to create a token](https://hackmd.io/@hackmd-api/how-to-issue-an-api-token))\n\n## Installation\n\n```shell\npip install python-HackMD\n```\n\n## Basic Usage\n\nLet's create an API object before everything starts.\n\n```python\nfrom PyHackMD import API\napi = API('<token>')\n```\n\n### User API\n\n1. Get user information\n```python\ndata = api.get_me()\nprint(data)\n```\n\n### User Notes API\n\n1. Get a list of notes in the user's workspace\n```python\ndata = api.get_notes()\nprint(data)\n```\n\n2. Get a note\n```python\n# note_id can be obtained using get_notes()\ndata = api.get_note('<note_id>')\nprint(data)\n```\n\n3. Create a note\n```python\ndata = api.create_note(\n            title='New Note',\n            content='blablabla',\n            read_perm='signed_in',\n            write_perm='owner',\n            comment_perm='signed_in_users')\nprint(data)\n```\n\n4. Update a note\n```python\n# note_id can be obtained using get_notes()\ndata = api.update_note(\n            '<note_id>',\n            content='blablabla',\n            read_perm='signed_in',\n            write_perm='owner',\n            comment_perm='signed_in_users')\nprint(data)\n```\n\n5. Delete a note\n```python\n# note_id can be obtained using get_notes()\ndata = api.delete_note('<note_id>')\nprint(data)\n```\n\n6. Get a history of read notes\n```python\ndata = api.get_read_history()\nprint(data)\n```\n\n### Teams API\n\n1. Get a list of the teams to which the user has permission\n```python\ndata = api.get_teams()\nprint(data)\n```\n\n### Team Notes API\n\n1. Get a list of notes in a Team's workspace\n```python\n# team_path can be obtained using get_teams()\ndata = api.get_team_notes('<team_path>')\nprint(data)\n```\n\n2. Get a note in a Team's workspace\n```python\n# note_id can be obtained using get_team_notes()\ndata = api.get_team_note('<note_id>')\nprint(data)\n```\n\n3. Create a note in a Team workspace\n```python\n# team_path can be obtained using get_teams()\ndata = api.create_team_note(\n            '<team_path>'\n            title='New Note',\n            content='blablabla',\n            read_perm='signed_in',\n            write_perm='owner',\n            comment_perm='signed_in_users')\nprint(data)\n```\n\n4. Update a note in a Team's workspace\n```python\n# team_path can be obtained using get_teams()\n# note_id can be obtained using get_team_notes()\ndata = api.update_team_note(\n            '<team_path>', '<note_id>',\n            content='blablabla',\n            read_perm='signed_in',\n            write_perm='owner',\n            comment_perm='signed_in_users')\nprint(data)\n```\n\n5. Delete a note in a Team's workspace\n```python\n# team_path can be obtained using get_teams()\n# note_id can be obtained using get_team_notes()\ndata = api.delete_team_note('<team_path>', '<note_id>')\nprint(data)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python interface for HackMD API",
    "version": "1.0.3",
    "project_urls": {
        "Homepage": "https://github.com/eugene87222/python-HackMD"
    },
    "split_keywords": [
        "hackmd",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7afeca2c70c65cbc0a4ca42d1cc5c72cfaf359ffe15a9edf71446419ac336ec0",
                "md5": "b2ceab12c6d275f11828715929a1c304",
                "sha256": "aa00ca0186d39e0db875b4d3e93dac23e963c0f3dc7e978efd8c4aa3a518fe14"
            },
            "downloads": -1,
            "filename": "python_HackMD-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b2ceab12c6d275f11828715929a1c304",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2826,
            "upload_time": "2024-05-10T15:42:24",
            "upload_time_iso_8601": "2024-05-10T15:42:24.738425Z",
            "url": "https://files.pythonhosted.org/packages/7a/fe/ca2c70c65cbc0a4ca42d1cc5c72cfaf359ffe15a9edf71446419ac336ec0/python_HackMD-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0deedccfc5f5f57fc27fbfdbb8d368920a6791e3c38a92cdd093f2f01dfaca4",
                "md5": "7cf5c8b8c374432ce59529d50f490292",
                "sha256": "265c3672da12fc79ce5e2051b46b40760228f92bc36329650b2085afc4188574"
            },
            "downloads": -1,
            "filename": "python-HackMD-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7cf5c8b8c374432ce59529d50f490292",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3103,
            "upload_time": "2024-05-10T15:42:26",
            "upload_time_iso_8601": "2024-05-10T15:42:26.344704Z",
            "url": "https://files.pythonhosted.org/packages/a0/de/edccfc5f5f57fc27fbfdbb8d368920a6791e3c38a92cdd093f2f01dfaca4/python-HackMD-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-10 15:42:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eugene87222",
    "github_project": "python-HackMD",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-hackmd"
}
        
Elapsed time: 0.70424s