Skip to content

Instantly share code, notes, and snippets.

@renxida
Created July 9, 2022 06:57
Show Gist options
  • Save renxida/1d4723284234d44a5a994b5e77788b62 to your computer and use it in GitHub Desktop.
Save renxida/1d4723284234d44a5a994b5e77788b62 to your computer and use it in GitHub Desktop.
Post from Terminal to napkin.one
#!/usr/bin/env python3
import requests
import json
import sys
# insert your own code and uid here
# see instructions at https://gist.github.com/renxida/9fc62a224339ce75db8c33ec6ebd8305
# on how to get them
uid = "aBcD1234"
code= "12345"
# read stdin into contents
content = sys.stdin.read()
url = "https://us-central1-deepthoughtworks.cloudfunctions.net/addTextToAccount"
payload = json.dumps({
"uid": uid,
"code": code,
"content": content,
"sourceUrl": "http://renxida.com/projects/napkin.py",
"integrationType": "Xidas Python Napkin Clipper"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment