ในภาษา Python เราสามารถเข้าถึง Pocket API ได้ด้วยโมดูล pocket-api
โมดูล pocket-api เป็นโมดูลสำหรับใช้งาน Pocket API โดยใช้ MIT License รองรับทั้ง Python 2 และ Python 3
ก่อนใช้งานต้องขอ Pocket API โดยเข้าไปที่ https://getpocket.com/developer/apps/new

แล้วจะได้ Consumer Key มา
เอาหมวด web ไปใส่ลงใน http://reader.fxneumann.de/plugins/oneclickpocket/auth.php จะได้ access_token กลับมาครบแล้วติดตั้งโมดูล pocket-api ด้วยคำสั่ง
pip install pocket-apiแล้วมาลงมือเขียนโค้ดกัน
[python]
from pocket import Pocket, PocketException
p = Pocket(
consumer_key='<Your Consumer Key>',
access_token='<Your Access Token>'
)
a=''
while a!='exit':
a=input('url :')
p.add(a)
[/python]
อ่านเอกสารเพิ่มเติมได้ที่ https://github.com/rakanalh/pocket-api
ขอบคุณครับ

0 ความคิดเห็น:
แสดงความคิดเห็น
แสดงความคิดเห็นได้ครับ :)