Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jeongukjae/pytistory

๐Ÿ“– Tistory Blog API Client written in Python.
https://github.com/jeongukjae/pytistory

api-client api-wrapper blogging python-library tistory

Last synced: 3 months ago
JSON representation

๐Ÿ“– Tistory Blog API Client written in Python.

Awesome Lists containing this project

README

        

PyTistory
=========

.. image:: https://circleci.com/gh/JeongUkJae/pytistory.svg?style=shield
:target: https://circleci.com/gh/JeongUkJae/pytistory
.. image:: https://travis-ci.org/JeongUkJae/pytistory.svg?branch=master
:target: https://travis-ci.org/JeongUkJae/pytistory
.. image:: https://codecov.io/gh/JeongUkJae/pytistory/branch/master/graph/badge.svg
:target: https://codecov.io/gh/JeongUkJae/pytistory
.. image:: https://requires.io/github/JeongUkJae/pytistory/requirements.svg?branch=master
:target: https://requires.io/github/JeongUkJae/pytistory/requirements/?branch=master
.. image:: https://img.shields.io/pypi/v/pytistory.svg
:target: https://pypi.org/project/pytistory
.. image:: https://img.shields.io/pypi/pyversions/pytistory.svg
:target: https://pypi.org/project/pytistory
.. image:: https://img.shields.io/pypi/l/pytistory.svg
:target: https://pypi.org/project/pytistory
.. image:: https://img.shields.io/pypi/status/pytistory.svg
:target: https://pypi.org/project/pytistory
.. image:: https://readthedocs.org/projects/pytistory/badge/?version=latest
:target: https://pytistory.readthedocs.io/ko/latest/?badge=latest
:alt: Documentation Status

PyTistory๋Š” `ํ‹ฐ์Šคํ† ๋ฆฌ ์˜คํ”ˆ API ๊ฐ€์ด๋“œ `_ ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ Python์œผ๋กœ ์ž‘์„ฑํ•œ ํ‹ฐ์Šคํ† ๋ฆฌ
API ํด๋ผ์ด์–ธํŠธ์ž…๋‹ˆ๋‹ค. `ํ‹ฐ์Šคํ† ๋ฆฌ ์˜คํ”ˆ API ๊ฐ€์ด๋“œ ์ธ์ฆ ๋ฐฉ์‹ `_ ์ค‘
Client-side flow ๋ฐฉ์‹์— ๋”ฐ๋ผ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ์‚ฌ์šฉ๋ฒ•์€ `PyTistory Documentation `_ ์—์„œ
ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Installation
------------

pytistory๋Š” ``pip``\ ๋ฅผ ํ†ตํ•ด ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

.. code-block:: bash

$ pip install pytistory

์‚ฌ์šฉ๋ฒ•
-------

์‚ฌ์šฉ์ž ์ธ์ฆ
~~~~~~~~~~~

์ธ์ฆ์ •๋ณด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์šฐ์„ ์ˆœ์œ„๋ฅผ ํ†ตํ•ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

- ์ง์ ‘ ์„ค์ •ํ•˜๋Š” ``configure``\ ํ•จ์ˆ˜๋กœ ๋„˜์–ด์˜ค๋Š” ``access_token``\์ธ์ž๊ฐ’
- ``configure``\ ํ•จ์ˆ˜๋กœ ๋„˜์–ด์˜ค๋Š” ``client_id``\, ``tistory_id``\, ``tistory_password``\ ์ธ์ž๊ฐ’
- ``configure``\ ํ•จ์ˆ˜๋กœ ๋„˜์–ด์˜ค๋Š” ``file_name``\์—์„œ ์ฝ์–ด๋“ค์ธ ์ธ์ž๊ฐ’
- ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ’
- ๊ธฐ๋ณธ ํŒŒ์ผ(``~/.pytistory/credentials.ini``\)์— ์„ค์ •๋˜์–ด ์žˆ๋Š” ๊ฐ’

์ฆ‰, ํ™˜๊ฒฝ๋ณ€์ˆ˜, ๊ธฐ๋ณธ ์„ค์ • ํŒŒ์ผ์— client id๊ฐ€ ์ ์šฉ๋˜์–ด ์žˆ๋‹ค ํ•˜๋”๋ผ๋„ ์ง์ ‘ ๋„˜๊ธฐ๋Š” ``file_name``\์— ์กด์žฌํ•˜๋Š” ์„ค์ •๋“ค์— ์˜ํ•ด ๋ฎ์–ด์”Œ์›Œ์ง€๊ณ ,
์ง์ ‘ ์ธ์ž๊ฐ’์œผ๋กœ ๋„˜๊ธฐ๋Š” ``client_id``\๋“ฑ์˜ ์ธ์ž๊ฐ’์— ์˜ํ•ด ๋ฎ์–ด์”Œ์›Œ์ง‘๋‹ˆ๋‹ค.

``access_token``\์ด ์ธ์ž๋กœ ๋„˜์–ด์˜ฌ ๊ฒฝ์šฐ ๋‹ค๋ฅธ ์˜ต์…˜์€ ์ „๋ถ€ ๋ฌด์‹œํ•˜๊ณ , ``access_token``\๋งŒ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

์ง์ ‘ Access Token ์„ค์ •
********************************

.. code-block:: python

from pytistory import PyTistory

pytistory = PyTistory()
pytistory.configure(
access_token='some-example-access-token')

ํ•จ์ˆ˜์˜ ์ธ์ž๊ฐ’์„ ํ†ตํ•œ ์„ค์ •
********************************

.. code-block:: python

from pytistory import PyTistory

pytistory = PyTistory()
pytistory.configure(
client_id='some-example-client-id',
tistory_id='some-example-tistory-id',
tistory_password='some-example-tistory-password')

ํŒŒ์ผ์„ ํ†ตํ•œ ์„ค์ •
******************

.. code-block:: python

from pytistory import PyTistory

pytistory = PyTistory()
pytistory.configure(
file_name='./some/path/to/credentials.ini')

ํŒŒ์ผ ํ˜•์‹์€ ini(Initialization)์„ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.

.. code-block:: ini

[pytistory]
client_id=some-client-id
tistory_id=some-tistory-id
tistory_password=some-tistory-password

ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ํ†ตํ•œ ์„ค์ •
**********************

ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋กœ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

.. code-block:: bash

export PYTISTORY_CLIENT_ID=some-example-client-id
export PYTISTORY_TISTORY_ID=some-example-tistory-id
export PYTISTORY_TISTORY_PASSWORD=some-example-tistory-password

APIํ˜ธ์ถœ
~~~~~~~~~~~~

https://www.tistory.com/apis/kind/action ์™€ ๊ฐ™์€ api๋ฅผ ํ˜ธ์ถœํ•  ๊ฒฝ์šฐ ์•„๋ž˜์ฒ˜๋Ÿผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.

.. code-block:: python

from pytistory import PyTistory

pytistory = PyTistory()
pytistory.configure()

response = pytistory.kind.action(args...)

์˜ˆ์‹œ๋กœ ๋ธ”๋กœ๊ทธ ์ •๋ณด๋ฅผ ๋ฐ›์•„์˜ค๋Š” ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

.. code-block:: python

from pytistory import PyTistory

pytistory = PyTistory()
pytistory.configure()

response = pytistory.blog.info()

๊ฒฐ๊ณผ๊ฐ’์€ ์•„๋ž˜์ฒ˜๋Ÿผ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

.. code-block:: json

{
"status": "200",
"id": "[email protected]",
"item": [
{
"url": "http://oauth.tistory.com",
"secondaryUrl": "http://",
"nickname": "Tistory API",
"title": "๋‚˜๋งŒ์˜ ์•ฑ, Tistory OAuth API ๋กœ ๋งŒ๋“ค์–ด๋ณด์„ธ์š”!",
"description": "",
"default": "Y",
"blogIconUrl":
"http://i1.daumcdn.net/cfs.tistory/blog/79/795307/index.gif",
"faviconUrl":
"http://i1.daumcdn.net/cfs.tistory/blog/79/795307/index.ico",
"profileThumbnailImageUrl":
"http://cfile1.uf.tistory.com/R106x0/1851DB584DAF942950AF29",
"profileImageUrl":
"http://cfile1.uf.tistory.com/R106x0/1851DB584DAF942950AF29",
"statistics": {
"post": "3",
"comment": "0",
"trackback": "0",
"guestbook": "0",
"invitation": "0"
}
},
{
"url": "http://oauth2.tistory.com",
"secondaryUrl": "http://",
"nickname": "Tistory API",
"title": "๋‚˜๋งŒ์˜ ๋น„๋ฐ€ ํ™ˆ",
"description": "",
"default": "N",
"blogIconUrl":
"http://i1.daumcdn.net/cfs.tistory/blog/79/795308/index.gif",
"faviconUrl":
"http://i1.daumcdn.net/cfs.tistory/blog/79/795308/index.ico",
"profileThumbnailImageUrl": "",
"profileImageUrl": "",
"blogId": "795308",
"statistics": {
"post": "0",
"comment": "0",
"trackback": "0",
"guestbook": "0",
"invitation": "0"
}
}
]
}

๊ธฐ์—ฌ
----

์ด ํ”„๋กœ์ ํŠธ๋Š” ๋ถ€์กฑํ•œ ์ ์ด ๋งŽ์Šต๋‹ˆ๋‹ค. Contribution์€ ์–ธ์ œ๋‚˜ ํ™˜์˜์ž…๋‹ˆ๋‹ค. ํ˜น์‹œ ์˜ค๋ฅ˜, ๋ฒ„๊ทธ ํ˜น์€ ์—…๋ฐ์ดํŠธ๊ฐ€ ํ•„์š”ํ•œ ์ ์ด ์žˆ์œผ์‹œ๋‹ค๋ฉด
`PR `_ ๋˜๋Š” `Issue `_ ๋ฅผ ํ†ตํ•ด
์–ธ์ œ๋“ ์ง€ ์•Œ๋ ค์ฃผ์„ธ์š”. ๐Ÿ‘

Copyright & License
-------------------

Copyright (c) 2018 JeongUkJae. MIT License.