-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error response for invalid credentials #19
Comments
Hey @hygull, the wrapper is not defining all methods explicitly, but rather using How do you know you have issues with authentication? The wrapper should bubble up any errors returned from the API, which should give you more insights as to why something is not working. What happens if you call, e.g. wp.get_posts() after initializing the wrapper? |
Statement@droustchev , I have set Permalinks as Post name and its value is I am trying to request in the following 2 ways, suggest me which one is ok. Error
Python codesfrom wordpress_json import *
# I should try this one
wp = WordpressJsonWrapper("http://demo4.sjainventures.com/Incredible/wp-json/wp/v2", "myuser", "mypass")
posts = wp.get_posts()
print posts
# or this one
wp = WordpressJsonWrapper("http://demo4.sjainventures.com/Incredible/sample-post/", "myuser", "mypass")
posts = wp.get_posts()
print posts ConsoleI'm getting the following on screen. CODE: 401
RESPONSE:<html>
<body>
<p>
{"code":"json_oauth1_missing_parameter","message":"Missing OAuth parameter oauth_token","data":{"status":401}}
</p>
</body>
</html>
HEADERS: {'X-Robots-Tag': 'noindex', 'X-Content-Type-Options': 'nosniff', 'X-Powered-By': 'PHP/5.6.31', 'Transfer-Encoding': 'chunked', 'Access-Control-Expose-Headers': 'X-WP-Total, X-WP-TotalPages', 'Server': 'Apache', 'Connection': 'close', 'Link': '<http://demo4.sjainventures.com/Incredible/wp-json/>; rel="https://api.w.org/"', 'Date': 'Thu, 15 Mar 2018 04:40:44 GMT', 'Access-Control-Allow-Headers': 'Authorization, Content-Type', 'Content-Type': 'application/json; charset=UTF-8'}
REQ_BODY:None
Because of json_oauth1_missing_parameter - Missing OAuth parameter oauth_token - {u'status': 401} |
Currently, this wrapper only supports Basic Auth, not OAuth, as stated under the limitations of the repo's README.md. If you want to get it working, you'll have to download the Basic Auth plugin and install it in your WP instance. When this wrapper was originally written, WP did not support any other authentication method other than Basic Auth. Nowadays it does and using Basic Auth in production is not advised, so keep that in mind please. Others have previously requested to add support for other authentication methods, but we unfortunately don't have enough time to add this. Any pull requests in that regard are encouraged and welcome! |
Today I tried to use this package. I tried to execute the below codes.
I got the same result in all 3 cases, o/p is also available at very bottom.
And this is not allowing me to figure out my issues with authentication, as
dir(wp)
is not containing theworking methods defined to work.
CODE SNIPPET 1
CODE SNIPPET 2
CODE SNIPPET 3
O/P
The text was updated successfully, but these errors were encountered: