falconry/falcon

User guide/FAQ: Send JSON & URL-encoded requests to the App

Open

#1.636 geöffnet am 11. Jan. 2020

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (925 Forks)batch import
documentationgood first issueneeds contributorquestion

Repository-Metriken

Stars
 (9.293 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 2T 7h) (9 gemergte PRs in 30 T)

Beschreibung

Hey, I'm trying to fetch out the data with JSON I've spent way too much time on google and tried every single solution with no success.. when I send the request it raises an json.decoder.JSONDecodeError Exception. maybe can you help?

class TextOcrRes:
    def on_post(self, req, resp):
        """Handles Text POST requests"""
        json_data = json.loads(req.bounded_stream.read().decode("utf-8")) # json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
        print(json_data)

What I'm sending:

r = requests.post("http://x.xx.xx.xx/translate", data={'image_data':'message'}) I'm on python 3.6.8

Contributor Guide