wp-api-python icon indicating copy to clipboard operation
wp-api-python copied to clipboard

struggling to pass arguments

Open kageanrage opened this issue 5 years ago • 2 comments

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.

kageanrage avatar Jul 20 '20 23:07 kageanrage

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!

d3v-null avatar Jul 26 '20 01:07 d3v-null

Thanks very much for your response. I'll do as you suggest!

kageanrage avatar Jul 26 '20 23:07 kageanrage