Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.66 KB

README.md

File metadata and controls

59 lines (41 loc) · 1.66 KB

clj-weibo

This Clojure library was designed to provide APIs for the third part applications to access sina weibo. It was flexble for developers to extend their requirements.

##Author

Usage

    (use '[clj-weibo core oauth2])
    (def my-weibo-config (merge weibo-default-config
                                {:client-id "Your App ID"
                                 :client-secret "Your App Secret"} ))


    ;; Get oauth2 authentication
    (request-auth-url my-weibo-config)
    ;; here will generate a url link for user to get oauth2 authentication.

    ;; set your oauth2 token
    (weibo-set-token "Oauth2 Token")

    ;; refer the API
    (weibo-wrap-api {:method :get
                     :api-version 2
                     :api-group :statuses
                     :api-key :public_timeline
                     :data {:count 10}} my-weibo-config)

    ;; Another examples

    (-> (weibo-wrap-api {:method :post
                          :api-version 2
                          :api-group :statuses
                          :api-key :update
                          :data {:status
                                (url-encode "Sent from Clojure Weibo API from Xiang Wang !") }}
                        my-weibo-config)
        (get "text"))

    (weibo-wrap-api {:method :get
                     :api-version 2
                     :api-group nil
                     :api-key :favorites
                     :data {:count 1 :page 1}} my-weibo-config)

License

Copyright © 2014

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.