I’m currently trying to make my script access a server on replit. It can reach it, but always returns an empty dict when the server sees the data.
Script:
local http = game:GetService("HttpService")
local Data = {
["d"] = "e"
}
Data = http:JSONEncode(Data)
r = http:PostAsync("https://replit-link/ret", Data) --Put the link you saved between the two quotes.
print(r)
My server:
from flask_restful import Resource, Api
from flask import Flask, jsonify
from threading import Thread
from flask import Flask, request, render_template
from PIL import Image, ImageOps
from io import BytesIO
import requests
import time
app = Flask(__name__)
api = Api(app)
@app.route("/",methods=["GET", "POST"])
def home():
return "Online"
@app.route('/ret', methods=['POST'])
def form_to_json():
data = request.form.to_dict(flat=False)
print(data) #tries to print data, gets nothing
return data
class GetFunction(Resource):
print("Functions loading")
def get(self, Function : str = None):
Data = "No data found."
return jsonify(Data) or Data
print("Functions loaded")
def run():
app.run(host = "0.0.0.0", port = 8080)
def start():
t = Thread(target = run)
t.start()
EDIT: It returns {} on the server