8000 update docco · Michels10/wp-api-python@f98ef85 · GitHub
[go: up one dir, main page]

Skip to content

Commit f98ef85

Browse files
author
derwentx
committed
update docco
add note about deleting
1 parent 355b264 commit f98ef85

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ Wordpress API - Python Client
44
A Python wrapper for the Wordpress and WooCommerce REST APIs with oAuth1a 3leg support.
55

66
Supports the Wordpress REST API v1-2, WooCommerce REST API v1-3 and WooCommerce WP-API v1-2 (with automatic OAuth3a handling).
7-
Forked from the excellent Woocommerce API written by Claudio Sanches and modified to work with Wordpress: https://github.com/woocommerce/wc-api-python
7+
Forked from the excellent WooCommerce API written by Claudio Sanches and modified to work with Wordpress: https://github.com/woocommerce/wc-api-python
88

99
I created this fork because I prefer the way that the wc-api-python client interfaces with
1010
the Wordpress API compared to the existing python client, https://pypi.python.org/pypi/wordpress_json
1111
which does not support OAuth authentication, only Basic Authentication (very unsecure)
1212

13-
Any suggestions about how this repository could be improved are welcome :)
13+
Any comments about how you're using the API and suggestions about how this repository could be improved are welcome :).
14+
You can find my contact info in my GitHub profile.
1415

1516
Roadmap
1617
-------
@@ -259,6 +260,18 @@ Example of returned data:
259260
>>> r.json()
260261
{u'posts': [{u'sold_individually': False,... // Dictionary data
261262
263+
A note on DELETE requests.
264+
=====
265+
266+
The extra keyword arguments passed to the function of a `__request` call (such as `.delete()`) to a `wordpress.API` object are used to modify a `Requests.request` call, this is to allow you to specify custom parameters to modify how the request is made such as `headers`. At the moment it only passes the `headers` parameter to requests, but if I see a use case for it, I can forward more of the parameters to `Requests`.
267+
The `delete` function doesn’t accept a data object because a HTTP DELETE request does not typically have a payload, and some implementations of a HTTP server would reject a DELETE request that has a payload.
268+
You can still pass api request parameters in the query string of the URL. I would suggest using a library like `urlparse` / `urllib.parse` to modify the query string if you are automatically deleting users.
269+
According the the [documentation](https://developer.wordpress.org/rest-api/reference/users/#delete-a-user) for deleting a user, you need to pass the `force` and `reassign` parameters to the API, which can be done by appending them to the endpoint URL.
270+
.. code-block:: python
271+
>>> response = wpapi.delete(‘/users/<Id>?reassign=<other_id>&force=true’)
272+
>>> response.json()
273+
{“deleted”:true, ... }
274+
262275
263276
Changelog
264277
---------

0 commit comments

Comments
 (0)
0