-
-
Save altendky/0db27536f0a5178680631bd695b9c1b9 to your computer and use it in GitHub Desktop.
neq_one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url='http://127.0.0.1:8090/blue' | |
hj=requests.post(url,{ | |
"device":"TemperatureSensor", | |
"value":"20", | |
"timestamp":"25/01/2017 10:10:05" | |
}) | |
print(hj.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Running on http://127.0.0.1:8090/ (Press CTRL+C to quit) | |
127.0.0.1 - - [22/Apr/2018 01:45:54] "POST /postjson/ HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:46:01] "GET / HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:46:01] "GET /robots.txt HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:51:46] "GET / HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:51:47] "GET /robots.txt HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:52:26] "GET /postjson' HTTP/1.1" 404 - | |
127.0.0.1 - - [22/Apr/2018 01:52:48] "GET /postjson/ HTTP/1.1" 404 - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import request | |
app = Flask(__name__) | |
@app.route('/postjson', methods = ['POST']) | |
def postJsonHandler(): | |
print (request.is_json) | |
content = request.get_json() | |
print (content) | |
return 'JSON posted' | |
app.run(port= 8090) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment