scrapbox-python
An unofficial wrapper around the Scrapbox API.
Installation
pip install scrapbox
# or `pipenv install scrapbox`
Basic Use
import scrapbox
client = scrapbox.Client()
project = client.get("/pages/help-jp/")
Examples
Get all the data of a project in JSON format
import json
client = scrapbox.Client()
project = client.get("/pages/help-jp/", limit=10)
# https://scrapbox.io/help-jp/
print(json.dumps(project, ensure_ascii=False, indent=2))
"""
{
"projectName": "help-jp",
"skip": 0,
"limit": 10,
"count": 73,
"pages": [
{
"id": "57c7d72ad25ef00f00100688",
"title": "Scrapboxの使い方",
"image": "https://gyazo.com/7057219f5b20ca8afd122945b72453d3/raw",
"descriptions": [
"[https://gyazo.com/7057219f5b20ca8afd122945b72453d3]",
"Scrapbox(スクラップボックス)の使い方・活用方法についてご紹介します。",
"[* 編集を始める]",
"まず最初に[ブラケティング]を読んでみましょう",
"[* チュートリアルで雰囲気をつかむ]"
],
"user": {
"id": "566f8b954fb08e1100af5c5b"
},
"pin": 9007197717386014,
"views": 34396,
"linked": 2,
"commitId": "5cf9c78742fc7800179f8c19",
"created": 1472713402,
"updated": 1559271981,
"accessed": 1562487581,
"snapshotCreated": 1559315996
},
...
"""
Get page data in JSON format
import json
client = scrapbox.Client()
page = client.get("/pages/help-jp/API")
# https://scrapbox.io/help-jp/API
print(json.dumps(page, ensure_ascii=False, indent=2))
"""
{
"id": "58e67688d0a4fe0011a0249c",
"title": "API",
"image": "https://gyazo.com/5bf55bb6223a62bf4477f07a9aad39b8/raw",
"descriptions": [
"[https://gyazo.com/5bf55bb6223a62bf4477f07a9aad39b8]",
"あくまで内部APIです。APIは予告なく変更を行います。",
"ページデータを取得するAPI",
"ページリスト",
"`/api/pages/:projectName`"
],
"user": {
"id": "5724627723541f110097c291",
"name": "shokai",
"displayName": "Sho Hashimoto",
"photo": "https://lh3.googleusercontent.com/-auiW-ZOVu6Y/AAAAAAAAAAI/AAAAAAAADLg/YwBeR9cziLU/photo.jpg"
},
"pin": 0,
"views": 7072,
"linked": 1,
"commitId": "5d135304ff5b5d0017cd83cc",
"created": 1491498636,
"updated": 1561547524,
"accessed": 1562490240,
"snapshotCreated": 1561586966,
"persistent": true,
"lines": [
{
"id": "58e67688d0a4fe0011a0249c",
"text": "API",
"userId": "5724627723541f110097c291",
"created": 1491498636,
"updated": 1491499158
},
...
"""
Get the body text of a page
client = scrapbox.Client()
text = client.get("/pages/help-jp/Scrapboxの使い方/text")
print(text)
"""
Scrapboxの使い方
[https://gyazo.com/7057219f5b20ca8afd122945b72453d3]
Scrapbox(スクラップボックス)の使い方・活用方法についてご紹介します。
[* 編集を始める]
まず最初に[ブラケティング]を読んでみましょう
[* チュートリアルで雰囲気をつかむ]
サンプルプロジェクト
Scrapboxを開発するNotaが実際に利用したページを一部そのまま公開します。
[Nota社のScrapboxを一部公開 https://scrapbox.io/nota-private-sample/]
[Scrapboxチュートリアルスライド]
使い方の概要を掴むことができます
実践テクニック
[エンジニアの生産性をあげるScrapboxの使い方 https://scrapbox.io/business/tutorial]
...
"""
Get the title image of a page
client = scrapbox.Client()
raw_image = client.get("/pages/help-jp/Scrapboxの使い方/icon")
with open("title.jpg", "wb") as f:
f.write(raw_image)
# Download the top icon as "title.jpg"
Metadata
Release files for scrapbox 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapbox-0.6.1.tar.gz | 3.9 kB | Without provenance | Details for scrapbox-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapbox-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for scrapbox-0.6.1-py3-none-any.whl |
Total release size: 8.9 kB
Release files / scrapbox-0.6.1.tar.gz
| Download URL | scrapbox-0.6.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2087e385de9f1ee8e63bd54a5e4e376ac0fc155fee91b4b579b53a700d67bd7c
|
|
BLAKE2b-256 checksum How to use checksums |
84deeef28840102ee23cc1dee4246e2f9387919c2f542bd64152e86950c2990f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / scrapbox-0.6.1-py3-none-any.whl
| Download URL | scrapbox-0.6.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78a21b6e1d46b4c0ecd87be591e12bbe9abb6aec7d996d06ec3aea8f2d00e666
|
|
BLAKE2b-256 checksum How to use checksums |
41f7df46b4c127d1a389b33c016e1b51fa487ba10e8606287c985fa33dc33ceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Security for scrapbox 0.6.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.