Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from wordpress import API
- import json
- base_url = "https://example.com/"
- api_path = "/wp-json/wp/v2"
- wpapi = API(
- url=base_url,
- api="wp-json",
- version='wp/v2',
- consumer_key = '***************************',
- consumer_secret = '***************************',
- basic_auth = True,
- user_auth = True,
- key='***************************',
- )
- r = wpapi.get('users' + '/' + 'me')
- data = r.json()
- userName = data['name']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement