首页 > 其他分享 >The GitHub Project xm-rpc-el/xml-rpc-el README.org

The GitHub Project xm-rpc-el/xml-rpc-el README.org

时间:2023-04-29 22:34:27浏览次数:52  
标签:xml el rpc wp wpcom foo

img
img
img
img

Commentary:

This is an XML-RPC client implementation in elisp, capable of both synchronous and asynchronous method calls (using the url package's async retrieval functionality).

XML-RPC is remote procedure calls over HTTP using XML to describe the function call and return values.

xml-rpc.el represents XML-RPC datatypes as lisp values, automatically converting to and from the XML datastructures as needed, both for method parameters and return values, making using XML-RPC methods fairly transparent to the lisp code.

Installation:

If you use ELPA, and have configured the NonGNU ELPA or MELPA repository, then M-x package-install RET xml-rpc RET interface. This is preferable as you will have access to updates automatically.

If you would like to use ELPA, but this is your first time to use it, or NonGNU ELPA/MELPA, then try evaluating the following code in emacs:

(progn
  (require 'package)
  (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  (unless (package-installed-p 'xml-rpc)
    (with-temp-buffer
      (url-insert-file-contents "https://raw.githubusercontent.com/xml-rpc-el/xml-rpc-el/master/xml-rpc.el")
      (package-install-from-buffer))))

Otherwise, just make sure this file in your load-path (usually ~/.emacs.d is included) and put

(require 'xml-rpc) 

in your ~/.emacs or ~/.emacs.d/init.el file.

Requirements

xml-rpc.el uses the url package for http handling and xml.el for XML parsing or, if you have Emacs 27+ with libxml included, libxml. The url package that is part of Emacs works fine.

Bug reports

Please use M-x xml-rpc-submit-bug-report to report bugs directly to the maintainer, or use github's issue system.

Representing data types

XML-RPC datatypes are represented as follows

type data
int 42
float/double 42.0
string "foo"
base64 (list :base64
  (base64-encode-string "hello" t))
  '(:base64 "aGVsbG8=")
array '(1 2 3 4) '(1 2 3 (4.1 4.2)) [ ]
  '(:array (("not" "a") ("struct" "!")))
struct '(("name" . "daniel")
  ("height" . 6.1))
dateTime '(:datetime (1234 124))

Examples

Here follows some examples demonstrating the use of xml-rpc.el

Normal synchronous operation

(xml-rpc-method-call "http://localhost:80/RPC" 'foo-method foo bar zoo)

Asynchronous example (cb-foo will be called when the methods returns)

(defun cb-foo (foo)
  (print (format "%s" foo)))

(xml-rpc-method-call-async 'cb-foo "http://localhost:80/RPC"
			   'foo-method foo bar zoo)

Some real world working examples for fun and play

These were last tested working on 2020-09-06.

Fetch the first state name from UserLand's server

(xml-rpc-method-call "http://betty.userland.com/rpc2"
		     'examples.getStateName '(1))

Results in:

Alabama

Get a list of supported methods from a blog

(mapconcat (lambda (s) (when s s))
  (xml-rpc-method-call "https://hexmode.wordpress.com/xmlrpc.php"
		       'mt.supportedMethods)
  ", ")

Results in:

wp.getUsersBlogs, wp.newPost, wp.editPost, wp.deletePost, wp.getPost, wp.getPosts, wp.newTerm, wp.editTerm, wp.deleteTerm, wp.getTerm, wp.getTerms, wp.getTaxonomy, wp.getTaxonomies, wp.getUser, wp.getUsers, wp.getProfile, wp.editProfile, wp.getPage, wp.getPages, wp.newPage, wp.deletePage, wp.editPage, wp.getPageList, wp.getAuthors, wp.getCategories, wp.getTags, wp.newCategory, wp.deleteCategory, wp.suggestCategories, wp.uploadFile, wp.deleteFile, wp.getCommentCount, wp.getPostStatusList, wp.getPageStatusList, wp.getPageTemplates, wp.getOptions, wp.setOptions, wp.getComment, wp.getComments, wp.deleteComment, wp.editComment, wp.newComment, wp.getCommentStatusList, wp.getMediaItem, wp.getMediaLibrary, wp.getPostFormats, wp.getPostType, wp.getPostTypes, wp.getRevisions, wp.restoreRevision, blogger.getUsersBlogs, blogger.getUserInfo, blogger.getPost, blogger.getRecentPosts, blogger.newPost, blogger.editPost, blogger.deletePost, metaWeblog.newPost, metaWeblog.editPost, metaWeblog.getPost, metaWeblog.getRecentPosts, metaWeblog.getCategories, metaWeblog.newMediaObject, metaWeblog.deletePost, metaWeblog.getUsersBlogs, mt.getCategoryList, mt.getRecentPostTitles, mt.getPostCategories, mt.setPostCategories, mt.supportedMethods, mt.supportedTextFilters, mt.getTrackbackPings, mt.publishPost, pingback.ping, pingback.extensions.getPingbacks, demo.sayHello, demo.addTwoNumbers, wpStats.get_key, wpStats.check_key, wpStats.get_blog_id, wpStats.get_site_id, wpStats.update_bloginfo, wpStats.update_postinfo, wpStats.ping_blog, wpStats.flush_posts, wpcom.get_user_blogids, wpcom.getFeatures, wpcom.addApplicationPassword, wpcom.blackberryUploadFile, wpcom.blackberryGetUploadingFileKeys, wpcom.getUsersSubs, wpcom.set_mobile_push_notification_settings, wpcom.get_mobile_push_notification_settings, wpcom.mobile_push_register_token, wpcom.mobile_push_unregister_token, wpcom.mobile_push_set_blogs_list, wpcom.mobile_push_win_phone_get_last_notification

标签:xml,el,rpc,wp,wpcom,foo
From: https://www.cnblogs.com/lywon/p/17364573.html

相关文章

  • XML-RPC Specification
    转载于http://xmlrpc.com/spec.md。:::{#idMenubar.divMenubar}:::{.topbar-wrapperstyle="z-index:5;"}:::{.navbar.navbar-fixed-topdropdown="dropdown"}:::divVersionNumber[]{#idPublishStatus}[]{#idSavedStatus} []{#idVersionNumber}......
  • window的shell怎么查看当前用户名
    在Windows的命令行界面下,可以使用%username%的环境变量来获取当前用户名。具体操作步骤如下:打开cmd命令提示符。可以使用Win+R组合键打开运行窗口,输入cmd命令,然后点击“确定”按钮。在命令提示符下输入echo%username%命令。按下回车键,在命令行界面中就可以看到当前登......
  • Python MatplotlibDeprecationWarning Matplotlib 3.6 and will be removed two minor
    百度飞桨(PaddlePaddle)-数字识别在Pycharm中使用Matplotlib中的pyplot时,运行代码报错:MatplotlibDeprecationWarning:SupportforFigureCanvaseswithoutarequired_interactive_frameworkattributewasdeprecatedinMatplotlib3.6andwillberemovedtwominorreleases......
  • python+playwright 学习-58 Jenkins上使用 Pipeline 运行 playwright 自动化脚本
    前言Dockerfile.focal可用于在Docker环境中运行Playwright脚本。这些镜像包括在Docker容器中运行浏览器所需的所有依赖项,还包括浏览器本身。playwright在linux系统上目前只支持Ubuntu系统的部分版本,centos和debian系统上是没法运行的。jenkins环境准备需安装2个跟docke......
  • GitHub 上有趣、入门级的开源项目HelloGitHub 升级版的 MiniGPT-4 搞定基于图片的文
    GitHub上有趣、入门级的开源项目HelloGitHub  https://github.com/521xueweihan/HelloGitHubhttps://github.com/521xueweihan/HelloGitHub/blob/master/content/HelloGitHub61.md 这里有实战项目、入门教程、黑科技、开源书籍、大厂开源项目等,涵盖多种编程语言Python......
  • dell 7080m black mac bios setup
    BISO设置参考的以下帖子,改了一部分内容USBWakeSupport和WakeonLAN/WLAN保持了默认,因为我用不到网络唤醒功能。​https://github.com/3dudu/dell-optiplex-7080-hackintosh-opencore设置项   值SATAOperation   AHCIIntegratedNIC   EnabledSecureBootEnable ......
  • thymeleaf学习问题整理
    使用配置<properties><java.version>1.8</java.version><thymeleaf.version>3.0.9.RELEASE</thymeleaf.version><thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version></p......
  • go语言channel
    go语言channel设计原理go语言中提倡:不要通过共享内存方式进行通信,而应该通过通信的方式共享内存。在很多编程语言中,多个线程传递数据的方式一般是共享内存,为了解决线程竞争,我们需要限制同一时间能够读写这些变量的线程数量,然而这与go语言的设计并不相同。虽然在go语言中也能使......
  • Python 希尔排序(Shell Sort)原理以及应用
    希尔排序的原理:希尔排序是把记录按下标的一定增量分组,对每组使用直接插入排序算法排序;随着增量逐渐减少,每组包含的关键词越来越多,当增量减至1时,整个文件恰被分成一组,算法便终止。希尔排序的原理是将待排序的序列按照一定间隔分成若干个子序列,对每个子序列使用插入排序进......
  • refusing to merge unrelated histories问题的解决
    问题描述将代码从云端拉取到本地,出现了这个错误,说我这里无法合并并不相关的历史,然后就屁颠屁颠地去找报错原因去了问题解决输入gitpulloriginmain--allow-unrelated-histories即,合并并不相关的分支,即便并不相关!然后,错误成功解决啦!......