Без опису

1234567891011121314151617181920212223242526272829303132
  1. from flask import Flask, render_template, request, redirect, jsonify
  2. import requests
  3. from flask_sqlalchemy import SQLAlchemy
  4. import datetime
  5. import json
  6. import urllib.request
  7. import os
  8. import csv
  9. import sys
  10. from time import sleep
  11. from random import sample
  12. i = 0
  13. listOfFood = [1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 15, 16, 17, 18, 19]
  14. while(i < 30):
  15. randomList = sample(listOfFood, 4)
  16. url = 'http://136.145.231.48:5000/papelonDeComida'
  17. data = [{'nombre': 'Prueba',
  18. 'celular': '(787)-969-0474',
  19. 'ordenCompleta': {
  20. 'order1': randomList[0],
  21. 'order2': randomList[1],
  22. 'order3': randomList[2],
  23. 'order4': randomList[3]},
  24. 'peticiones': {
  25. }}]
  26. response = requests.post(url, json=data)
  27. print(response)
  28. i += 2
  29. sleep(1)