Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function postPythonScript() {
- const url = 'https://run.glot.io/languages/python/latest';
- const body = JSON.stringify({files: [{name: "main.py", content: "print(7)"}]});
- const token = "41354f0c-5b9a-45d3-b0d0-66b444f555d4"; // doesn't need to be so secret.
- const method = 'POST';
- const headers = new Headers({
- 'Authorization': token,
- 'Content-Type': 'application/json',
- });
- try {
- const response = await fetch(url, {method, headers, body});
- print(data);
- } catch (error) {
- console.error(error);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement