Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import base64
- import requests
- import json
- wp_user = "santosarker00@gmail.com"
- wp_password = "Eu5l dNYx qpnr KkOP TRWx QrgD"
- wp_credential = f"{wp_user}:{wp_password}"
- wp_token = base64.b64encode(wp_credential.encode()).decode()
- wp_headers = {"Authorization": f"Basic {wp_token}"}
- url = "https://dev-shoaibsanto.pantheonsite.io/wp-json/wp/v2/posts"
- data = {
- "title": "Sample Title",
- "content": "Sample Content",
- "slug": "sample-url",
- "status": "publish"
- }
- # Send a POST request with headers and JSON data
- res = requests.post(url, headers=wp_headers, json=data, verify=False)
- print(res.status_code)
- print(res.text)
Add Comment
Please, Sign In to add comment