Created
July 14, 2014 02:03
-
-
Save shurru/c3b27f8c982cbf17fcb6 to your computer and use it in GitHub Desktop.
Flasklearning
This file contains hidden or 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
@app.route('/insert', methods=['POST', 'GET']) | |
def dumper(): | |
if request.method == 'POST': | |
# var= request.data | |
var= request.args.get('data') | |
var2= request.data | |
result= {"O1":var} | |
print result | |
print var2 | |
posts.insert(result) | |
return "Inserted" | |
##END of flask bit## | |
##start of python requests bit## | |
url= 'http://127.0.0.1:5000/insert' | |
data1= {"O1":np.random.randint(4000,5000)} #generating of a random number | |
r= requests.post(url, data= data1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment