wp-api-python
wp-api-python copied to clipboard
struggling to pass arguments
regardless of what arguments I try to pass, they seem to get ignored, and I just get the same response, so I must have the formatting wrong. I can't see a clear example in the library documentation re. how to pass arguments / clarify the desired endpoint
e.g.
r = wpapi.get("posts")
(and then printing the json contents of the variable 'r')
... yields the same response as:
r = wpapi.get("posts?status=draft")
or
r = wpapi.get("posts?slug=member_post_abc")
If you could please clarify, I'd be grateful.
Hi there, just a reminder that this repo is no longer maintained, and for this reason I would advise against people using it.
It looks like you're using the WP API correctly. https://developer.wordpress.org/rest-api/reference/posts/
There are tests that cover passing query string parameters like this, so it really should just work. https://github.com/derwentx/wp-api-python/blob/27e0385a9ceb3715c98768f3adf565142ba93387/tests/test_api.py#L405
I'd suggest if you have access to your webserver's raw access logs, to check that the correct params are indeed being passed through to the webserver. If they are, then this is not a problem with the client.
If you don't have access to the webserver's access logs, you can always try postman, mitmproxy or wireshark.
good luck!
Thanks very much for your response. I'll do as you suggest!