Last active
April 30, 2019 15:37
-
-
Save agritheory/4e322dec3682741fe745c631eb91fa0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from base64 import b64encode | |
import json | |
def push_po(doc, method): | |
# additional business logic or other validations | |
# prune document fields and turn into json | |
payload = json.loads({"docfield": doc}) | |
api_key, api_secret = frappe.get_value("User", frappe.session.user, ["api_key", "api_secret"]) | |
url = "http://frappe.local:8000**/api/resource/Purchase Order" | |
headers = {'Authorization': "Basic %s" % b64encode(api_key:api_secret)} | |
response = requests.request("POST", url, headers=headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment