1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

闇のプログラミングAdvent Calendar 2023

Day 24

暗黒Lambda

Last updated at Posted at 2023-12-23

まあ失敗してるんですけど

よくないことはできないね。

オンラインでプログラム書けるところじゃん

ここにソース流して実行した結果取れたらLambdaみたいな使い方できないかなとおもった

動きを見てみるか

ブラウザのデベロッパーツールで実行時のリクエスト見てみた。

Httpの中身

リクエスト

image.png

レスポンス

image.png

requestのbodyでプログラムを文字列で渡しててresponseのstdoutに結果が変えてくるわけね

じゃあpythonで再現書いてみるか

lambda
import requests
import json
param = '{"project":{"source_files":[{"filename":"Main.py","body":"import requests\nimport json\nr = requests.get(f\"http://www.google.co.jp")\nprint(r.text)\n","position":0}],"language":"python3","share":"private","network":true,"output_type":null},"run":true,"save":true}'
r = requests.post("https://paiza.io/api/projects.json", json = param)
j = json.loads(r.text)
print(j)

結果

{'status': '400', 'error': 'Bad Request'}

そりゃそうだ

結論

清く生きる

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?