Created
July 13, 2016 13:40
-
-
Save jawache/f2cb9298cb6be0be1f2ff6e0a913c832 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from bottle import route, run, Bottle, HTTPResponse, error, static_file | |
from bottle import response, request | |
import json | |
import time | |
from sys import argv | |
app = Bottle() | |
@app.hook('after_request') | |
def enable_cors(): | |
""" | |
You need to add some headers to each request. | |
Don't use the wildcard '*' for Access-Control-Allow-Origin in production. | |
""" | |
print "enabling cors" | |
response.headers['Access-Control-Allow-Origin'] = '*' | |
response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' | |
response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' | |
PERSONS = """[ | |
{ | |
"name": "Hop White", | |
"email": "Vestibulum.ante@imperdietnecleo.edu", | |
"birthdate": "2014-03-09T13:16:14-07:00", | |
"phonenumber": "055 7246 7985", | |
"address": "1092 Luctus Rd.", | |
"city": "Viersel", | |
"country": "Jersey", | |
"id": 1 | |
}, | |
{ | |
"name": "Brendan Landry", | |
"email": "feugiat.Sed@ultricesiaculisodio.net", | |
"birthdate": "2014-09-28T00:38:35-07:00", | |
"phonenumber": "07715 194810", | |
"address": "Ap #787-9503 Lobortis St.", | |
"city": "Cuenca", | |
"country": "Comoros", | |
"id": 2 | |
}, | |
{ | |
"name": "Kato Everett", | |
"email": "malesuada.fames.ac@auctor.ca", | |
"birthdate": "2015-08-27T10:15:03-07:00", | |
"phonenumber": "07624 441423", | |
"address": "401-1263 Non Rd.", | |
"city": "Devon", | |
"country": "Malawi", | |
"id": 3 | |
}, | |
{ | |
"name": "Chancellor Burke", | |
"email": "Phasellus.vitae.mauris@indolor.co.uk", | |
"birthdate": "2015-11-14T16:52:54-08:00", | |
"phonenumber": "0800 468 1908", | |
"address": "5611 Sociis St.", | |
"city": "Grivegn�e", | |
"country": "Chad", | |
"id": 4 | |
}, | |
{ | |
"name": "Nash Phillips", | |
"email": "rhoncus@mienimcondimentum.ca", | |
"birthdate": "2015-01-28T09:37:45-08:00", | |
"phonenumber": "07718 412299", | |
"address": "P.O. Box 703, 5533 Convallis Street", | |
"city": "Luzzara", | |
"country": "Uzbekistan", | |
"id": 5 | |
}, | |
{ | |
"name": "Kuame Washington", | |
"email": "at.nisi.Cum@justoProin.ca", | |
"birthdate": "2016-02-19T16:45:52-08:00", | |
"phonenumber": "(014231) 33185", | |
"address": "P.O. Box 681, 477 Ultrices Ave", | |
"city": "St. Albans", | |
"country": "Guernsey", | |
"id": 6 | |
}, | |
{ | |
"name": "Vaughan Gay", | |
"email": "Vivamus.sit@parturientmontes.org", | |
"birthdate": "2014-04-27T12:13:15-07:00", | |
"phonenumber": "0845 46 48", | |
"address": "Ap #155-9764 Quam St.", | |
"city": "Itabuna", | |
"country": "Oman", | |
"id": 7 | |
}, | |
{ | |
"name": "Brenden Vinson", | |
"email": "dolor.quam.elementum@ullamcorpereueuismod.co.uk", | |
"birthdate": "2015-05-26T16:29:54-07:00", | |
"phonenumber": "0390 168 1985", | |
"address": "P.O. Box 109, 7461 Ac St.", | |
"city": "Bharatpur", | |
"country": "Pakistan", | |
"id": 8 | |
}, | |
{ | |
"name": "Buckminster Flowers", | |
"email": "a.neque@et.ca", | |
"birthdate": "2014-12-23T17:13:43-08:00", | |
"phonenumber": "(020) 7218 2282", | |
"address": "798-7539 Purus Ave", | |
"city": "San Giovanni la Punta", | |
"country": "India", | |
"id": 9 | |
}, | |
{ | |
"name": "Ryder Trevino", | |
"email": "pede.ultrices@sitametornare.edu", | |
"birthdate": "2015-04-11T12:29:37-07:00", | |
"phonenumber": "0907 274 2272", | |
"address": "2702 Dictum St.", | |
"city": "Baisy-Thy", | |
"country": "Korea, North", | |
"id": 10 | |
}, | |
{ | |
"name": "Declan Foster", | |
"email": "Cum.sociis@eratneque.net", | |
"birthdate": "2015-04-24T09:23:15-07:00", | |
"phonenumber": "(01749) 79338", | |
"address": "218-4843 Vivamus St.", | |
"city": "Wals-Siezenheim", | |
"country": "Laos", | |
"id": 11 | |
}, | |
{ | |
"name": "Travis Leach", | |
"email": "tristique.ac.eleifend@duiCum.edu", | |
"birthdate": "2014-04-15T07:52:40-07:00", | |
"phonenumber": "0800 1111", | |
"address": "793-7833 Vivamus St.", | |
"city": "Burntisland", | |
"country": "South Sudan", | |
"id": 12 | |
}, | |
{ | |
"name": "Jordan Fernandez", | |
"email": "netus.et.malesuada@lectussit.com", | |
"birthdate": "2015-04-23T15:14:40-07:00", | |
"phonenumber": "(016977) 9627", | |
"address": "Ap #894-7023 Euismod Avenue", | |
"city": "Maria", | |
"country": "Dominica", | |
"id": 13 | |
}, | |
{ | |
"name": "Joel Griffith", | |
"email": "vulputate@anteMaecenasmi.edu", | |
"birthdate": "2015-04-14T12:40:10-07:00", | |
"phonenumber": "07624 407054", | |
"address": "4946 Justo. Rd.", | |
"city": "Ingelheim", | |
"country": "Benin", | |
"id": 14 | |
}, | |
{ | |
"name": "Amos Quinn", | |
"email": "in.consequat.enim@consequat.org", | |
"birthdate": "2016-01-15T07:29:43-08:00", | |
"phonenumber": "(016977) 2512", | |
"address": "Ap #594-4113 Libero Road", | |
"city": "Noisy-le-Grand", | |
"country": "Iceland", | |
"id": 15 | |
}, | |
{ | |
"name": "Burke Walls", | |
"email": "dui@Proinnon.com", | |
"birthdate": "2015-09-07T06:01:40-07:00", | |
"phonenumber": "056 7163 4367", | |
"address": "P.O. Box 129, 9359 Lacinia Rd.", | |
"city": "Crowsnest Pass", | |
"country": "Comoros", | |
"id": 16 | |
}, | |
{ | |
"name": "Quinn Hanson", | |
"email": "diam@orcitincidunt.co.uk", | |
"birthdate": "2015-07-16T21:56:26-07:00", | |
"phonenumber": "0500 763631", | |
"address": "3209 Integer St.", | |
"city": "Grand-Hallet", | |
"country": "United Kingdom (Great Britain)", | |
"id": 17 | |
}, | |
{ | |
"name": "Brock Tyson", | |
"email": "In.mi.pede@posuerevulputatelacus.org", | |
"birthdate": "2015-07-16T15:26:25-07:00", | |
"phonenumber": "07624 381546", | |
"address": "Ap #697-9535 At, Av.", | |
"city": "Greifswald", | |
"country": "Seychelles", | |
"id": 18 | |
}, | |
{ | |
"name": "Kermit Henry", | |
"email": "id@perconubia.org", | |
"birthdate": "2015-10-15T17:50:37-07:00", | |
"phonenumber": "(016977) 4137", | |
"address": "582-5015 Diam. Ave", | |
"city": "Nuraminis", | |
"country": "Bulgaria", | |
"id": 19 | |
}, | |
{ | |
"name": "Carlos Dickerson", | |
"email": "aliquam.enim.nec@velnislQuisque.org", | |
"birthdate": "2014-04-22T12:11:04-07:00", | |
"phonenumber": "(0141) 996 4206", | |
"address": "Ap #496-1256 Porta Street", | |
"city": "Grivegn�e", | |
"country": "Faroe Islands", | |
"id": 20 | |
}, | |
{ | |
"name": "Carter Gilbert", | |
"email": "Duis.sit@sodalespurusin.net", | |
"birthdate": "2015-12-30T17:12:38-08:00", | |
"phonenumber": "0800 224 9534", | |
"address": "1346 Ullamcorper Avenue", | |
"city": "Klemskerke", | |
"country": "Saint Vincent and The Grenadines", | |
"id": 21 | |
}, | |
{ | |
"name": "Vance Carlson", | |
"email": "tincidunt@tristiquesenectuset.net", | |
"birthdate": "2016-01-27T19:59:24-08:00", | |
"phonenumber": "0391 335 6111", | |
"address": "9350 Vitae Av.", | |
"city": "Montbéliard", | |
"country": "Wallis and Futuna", | |
"id": 22 | |
}, | |
{ | |
"name": "Hunter Buckner", | |
"email": "neque@risus.edu", | |
"birthdate": "2014-08-23T21:44:02-07:00", | |
"phonenumber": "055 0187 0668", | |
"address": "3142 Placerat. St.", | |
"city": "Terlago", | |
"country": "Belize", | |
"id": 23 | |
}, | |
{ | |
"name": "Tate Norton", | |
"email": "est.congue.a@adipiscing.com", | |
"birthdate": "2015-11-10T00:06:00-08:00", | |
"phonenumber": "0845 46 48", | |
"address": "Ap #115-3567 Vitae Ave", | |
"city": "Bedollo", | |
"country": "Nigeria", | |
"id": 24 | |
}, | |
{ | |
"name": "Julian Guthrie", | |
"email": "urna.Vivamus@sedtortor.net", | |
"birthdate": "2015-10-28T17:45:59-07:00", | |
"phonenumber": "(016977) 4435", | |
"address": "Ap #811-6195 Montes, Ave", | |
"city": "Cabras", | |
"country": "Cyprus", | |
"id": 25 | |
}, | |
{ | |
"name": "Ray Snow", | |
"email": "imperdiet.nec@montesnasceturridiculus.edu", | |
"birthdate": "2015-03-12T05:23:09-07:00", | |
"phonenumber": "0878 419 7111", | |
"address": "Ap #843-1437 Mus. St.", | |
"city": "Emarèse", | |
"country": "Eritrea", | |
"id": 26 | |
}, | |
{ | |
"name": "Herrod Elliott", | |
"email": "conubia@euerat.edu", | |
"birthdate": "2015-12-13T04:19:33-08:00", | |
"phonenumber": "070 3617 4151", | |
"address": "411-3644 Nisi Rd.", | |
"city": "Auxerre", | |
"country": "Slovenia", | |
"id": 27 | |
}, | |
{ | |
"name": "Randall Lloyd", | |
"email": "lectus.sit.amet@amet.co.uk", | |
"birthdate": "2014-09-24T07:16:44-07:00", | |
"phonenumber": "(0114) 373 8244", | |
"address": "P.O. Box 865, 3925 Bibendum. Rd.", | |
"city": "Suarlee", | |
"country": "Latvia", | |
"id": 28 | |
}, | |
{ | |
"name": "Wade Russo", | |
"email": "a.sollicitudin@pedePraesent.co.uk", | |
"birthdate": "2015-05-17T01:37:06-07:00", | |
"phonenumber": "0946 737 4573", | |
"address": "Ap #169-4717 In Av.", | |
"city": "Castel Baronia", | |
"country": "Malta", | |
"id": 29 | |
}, | |
{ | |
"name": "Patrick Kerr", | |
"email": "elit.elit@scelerisque.ca", | |
"birthdate": "2015-09-06T11:32:47-07:00", | |
"phonenumber": "070 3924 6723", | |
"address": "8394 Sit Rd.", | |
"city": "Wachtebeke", | |
"country": "Madagascar", | |
"id": 30 | |
}, | |
{ | |
"name": "Camden Callahan", | |
"email": "Quisque.nonummy.ipsum@Nam.net", | |
"birthdate": "2016-01-13T15:17:00-08:00", | |
"phonenumber": "0953 721 8838", | |
"address": "777-5533 Enim. St.", | |
"city": "Elsene", | |
"country": "South Africa", | |
"id": 31 | |
}, | |
{ | |
"name": "Griffin Calhoun", | |
"email": "mollis@sapienCrasdolor.co.uk", | |
"birthdate": "2014-03-18T22:39:01-07:00", | |
"phonenumber": "(0114) 841 6433", | |
"address": "Ap #554-7352 Ornare, Ave", | |
"city": "Mobile", | |
"country": "Japan", | |
"id": 32 | |
}, | |
{ | |
"name": "Clinton Forbes", | |
"email": "quis.turpis.vitae@ut.edu", | |
"birthdate": "2015-04-26T07:51:52-07:00", | |
"phonenumber": "07624 778216", | |
"address": "842-8807 Lacus. Road", | |
"city": "Pinneberg", | |
"country": "South Africa", | |
"id": 33 | |
}, | |
{ | |
"name": "Kareem Atkinson", | |
"email": "orci@arcu.ca", | |
"birthdate": "2014-10-22T19:44:35-07:00", | |
"phonenumber": "055 4640 4726", | |
"address": "3222 Hymenaeos. Rd.", | |
"city": "Borghetto di Vara", | |
"country": "Azerbaijan", | |
"id": 34 | |
}, | |
{ | |
"name": "Igor Marshall", | |
"email": "leo@magnaUttincidunt.org", | |
"birthdate": "2015-12-16T00:35:03-08:00", | |
"phonenumber": "0826 230 2764", | |
"address": "8602 Hendrerit Rd.", | |
"city": "Torrevieja", | |
"country": "Fiji", | |
"id": 35 | |
}, | |
{ | |
"name": "Lawrence Kinney", | |
"email": "Sed.dictum@aliquamenimnec.co.uk", | |
"birthdate": "2015-07-31T04:19:46-07:00", | |
"phonenumber": "0845 46 48", | |
"address": "190-6354 Mi Av.", | |
"city": "Galway", | |
"country": "Afghanistan", | |
"id": 36 | |
}, | |
{ | |
"name": "Wade Stevens", | |
"email": "leo@convallisantelectus.com", | |
"birthdate": "2015-10-20T23:39:54-07:00", | |
"phonenumber": "0800 425595", | |
"address": "386-3604 Nulla. Rd.", | |
"city": "Acciano", | |
"country": "Norfolk Island", | |
"id": 37 | |
}, | |
{ | |
"name": "Dillon Johns", | |
"email": "nunc.interdum.feugiat@ullamcorpereu.ca", | |
"birthdate": "2014-07-12T09:05:04-07:00", | |
"phonenumber": "0899 327 1733", | |
"address": "5879 Luctus St.", | |
"city": "Surat", | |
"country": "Barbados", | |
"id": 38 | |
}, | |
{ | |
"name": "Kelly Hatfield", | |
"email": "metus.vitae.velit@in.org", | |
"birthdate": "2015-12-18T21:54:42-08:00", | |
"phonenumber": "0934 010 6148", | |
"address": "7039 Vitae St.", | |
"city": "Hearst", | |
"country": "Heard Island and Mcdonald Islands", | |
"id": 39 | |
}, | |
{ | |
"name": "Thomas Torres", | |
"email": "nec.ante.Maecenas@sitametmassa.com", | |
"birthdate": "2015-11-23T21:36:15-08:00", | |
"phonenumber": "0500 806917", | |
"address": "P.O. Box 877, 4388 Aliquet Avenue", | |
"city": "Rathenow", | |
"country": "British Indian Ocean Territory", | |
"id": 40 | |
}, | |
{ | |
"name": "Vladimir Simon", | |
"email": "a@purus.org", | |
"birthdate": "2016-02-08T11:36:10-08:00", | |
"phonenumber": "0845 46 44", | |
"address": "Ap #451-6252 Sed, Road", | |
"city": "Borno", | |
"country": "Belgium", | |
"id": 41 | |
}, | |
{ | |
"name": "Omar Underwood", | |
"email": "pellentesque.tellus.sem@rutrumjustoPraesent.com", | |
"birthdate": "2014-06-14T07:37:37-07:00", | |
"phonenumber": "0800 661 4432", | |
"address": "112-3654 Nullam Rd.", | |
"city": "Mundare", | |
"country": "Netherlands", | |
"id": 42 | |
}, | |
{ | |
"name": "Mohammad Reeves", | |
"email": "cursus@aaliquetvel.net", | |
"birthdate": "2015-12-16T07:33:24-08:00", | |
"phonenumber": "(013496) 36910", | |
"address": "P.O. Box 524, 7970 Consectetuer Ave", | |
"city": "Lourdes", | |
"country": "Malta", | |
"id": 43 | |
}, | |
{ | |
"name": "Leroy Morse", | |
"email": "nulla@felis.net", | |
"birthdate": "2015-01-09T17:39:13-08:00", | |
"phonenumber": "0800 367161", | |
"address": "P.O. Box 914, 1287 Risus. Road", | |
"city": "Camrose", | |
"country": "Australia", | |
"id": 44 | |
}, | |
{ | |
"name": "Reed Shannon", | |
"email": "purus@lobortistellusjusto.ca", | |
"birthdate": "2015-09-04T20:55:30-07:00", | |
"phonenumber": "(028) 7924 0327", | |
"address": "P.O. Box 573, 9855 Massa Road", | |
"city": "Oostkerk", | |
"country": "Reunion", | |
"id": 45 | |
}, | |
{ | |
"name": "Raja Zimmerman", | |
"email": "massa.Suspendisse@Proinvel.org", | |
"birthdate": "2016-01-01T10:38:25-08:00", | |
"phonenumber": "(0112) 391 3083", | |
"address": "Ap #169-5117 In Street", | |
"city": "Bègles", | |
"country": "Armenia", | |
"id": 46 | |
}, | |
{ | |
"name": "Eaton Gross", | |
"email": "eu@Sedauctorodio.ca", | |
"birthdate": "2014-12-24T19:40:32-08:00", | |
"phonenumber": "(01943) 346242", | |
"address": "Ap #845-2282 Suspendisse St.", | |
"city": "Offenbach am Main", | |
"country": "Saudi Arabia", | |
"id": 47 | |
}, | |
{ | |
"name": "Tyler Dudley", | |
"email": "felis@et.com", | |
"birthdate": "2014-08-05T13:56:16-07:00", | |
"phonenumber": "07624 555572", | |
"address": "569-2514 Egestas Street", | |
"city": "Nampa", | |
"country": "Guyana", | |
"id": 48 | |
}, | |
{ | |
"name": "Ethan Jacobson", | |
"email": "tellus@duiinsodales.org", | |
"birthdate": "2015-04-01T19:22:23-07:00", | |
"phonenumber": "(016977) 1347", | |
"address": "P.O. Box 773, 4143 Pretium Street", | |
"city": "Waarmaarde", | |
"country": "American Samoa", | |
"id": 49 | |
}, | |
{ | |
"name": "Malcolm Houston", | |
"email": "ac.metus@Donecatarcu.ca", | |
"birthdate": "2016-02-24T16:00:26-08:00", | |
"phonenumber": "(01907) 69491", | |
"address": "9504 At St.", | |
"city": "Montemesola", | |
"country": "Kazakhstan", | |
"id": 50 | |
}, | |
{ | |
"name": "Keane Pratt", | |
"email": "sed.orci@hendreritaarcu.com", | |
"birthdate": "2015-01-25T20:04:41-08:00", | |
"phonenumber": "0354 555 9124", | |
"address": "457-2737 Proin Street", | |
"city": "Parkland County", | |
"country": "Indonesia", | |
"id": 51 | |
}, | |
{ | |
"name": "Clark Frye", | |
"email": "tempor.augue@faucibus.org", | |
"birthdate": "2014-03-19T02:15:26-07:00", | |
"phonenumber": "0955 058 2331", | |
"address": "193-1442 Elit, Av.", | |
"city": "Memphis", | |
"country": "Belarus", | |
"id": 52 | |
}, | |
{ | |
"name": "Hamilton Mullins", | |
"email": "eu@dictumPhasellusin.ca", | |
"birthdate": "2014-04-13T17:58:00-07:00", | |
"phonenumber": "0800 276 3486", | |
"address": "Ap #459-2186 Sem Road", | |
"city": "Kitscoty", | |
"country": "Christmas Island", | |
"id": 53 | |
}, | |
{ | |
"name": "Hayden Palmer", | |
"email": "gravida@scelerisquelorem.co.uk", | |
"birthdate": "2015-09-09T14:12:20-07:00", | |
"phonenumber": "(010804) 61067", | |
"address": "P.O. Box 241, 6208 Iaculis Road", | |
"city": "Kirkwall", | |
"country": "Côte D'Ivoire (Ivory Coast)", | |
"id": 54 | |
}, | |
{ | |
"name": "Kyle Valencia", | |
"email": "pellentesque.eget.dictum@morbi.ca", | |
"birthdate": "2015-07-25T04:24:14-07:00", | |
"phonenumber": "(01048) 35913", | |
"address": "9855 Dolor. Av.", | |
"city": "Sterling Heights", | |
"country": "Peru", | |
"id": 55 | |
}, | |
{ | |
"name": "Wang Hayden", | |
"email": "dui.Suspendisse.ac@mollisnoncursus.org", | |
"birthdate": "2015-03-03T21:51:18-08:00", | |
"phonenumber": "076 5118 5694", | |
"address": "998-3658 Lacinia Rd.", | |
"city": "Goiânia", | |
"country": "Liberia", | |
"id": 56 | |
}, | |
{ | |
"name": "Jordan Moore", | |
"email": "sed@neque.org", | |
"birthdate": "2014-05-12T18:13:35-07:00", | |
"phonenumber": "(0115) 221 8921", | |
"address": "Ap #151-4686 At Ave", | |
"city": "Salvirola", | |
"country": "Faroe Islands", | |
"id": 57 | |
}, | |
{ | |
"name": "Wesley York", | |
"email": "vulputate.lacus.Cras@liberoettristique.com", | |
"birthdate": "2015-09-07T20:45:42-07:00", | |
"phonenumber": "0845 46 41", | |
"address": "P.O. Box 891, 7045 Nonummy St.", | |
"city": "Tregaron", | |
"country": "Greece", | |
"id": 58 | |
}, | |
{ | |
"name": "Declan Shannon", | |
"email": "velit.Cras.lorem@mus.co.uk", | |
"birthdate": "2015-01-18T20:22:09-08:00", | |
"phonenumber": "0323 885 3137", | |
"address": "P.O. Box 466, 9916 Donec Avenue", | |
"city": "North Barrackpur", | |
"country": "Laos", | |
"id": 59 | |
}, | |
{ | |
"name": "Wylie Valdez", | |
"email": "rhoncus.id@anteipsum.net", | |
"birthdate": "2014-12-08T19:45:49-08:00", | |
"phonenumber": "0946 775 7575", | |
"address": "P.O. Box 193, 7390 Enim. Av.", | |
"city": "Somma Lombardo", | |
"country": "Azerbaijan", | |
"id": 60 | |
}, | |
{ | |
"name": "Harlan Kirby", | |
"email": "turpis@nuncsedlibero.ca", | |
"birthdate": "2015-04-07T14:57:48-07:00", | |
"phonenumber": "0367 453 8722", | |
"address": "Ap #170-2299 Ornare St.", | |
"city": "Abaetetuba", | |
"country": "Northern Mariana Islands", | |
"id": 61 | |
}, | |
{ | |
"name": "Alec Mcguire", | |
"email": "Duis.dignissim.tempor@duinec.ca", | |
"birthdate": "2015-06-27T12:35:24-07:00", | |
"phonenumber": "0919 652 5303", | |
"address": "670-9789 Erat Street", | |
"city": "Vieuxville", | |
"country": "Ethiopia", | |
"id": 62 | |
}, | |
{ | |
"name": "Brody Vang", | |
"email": "Curabitur.massa@laoreetipsum.net", | |
"birthdate": "2015-03-30T15:31:59-07:00", | |
"phonenumber": "0800 312 3805", | |
"address": "605-296 At St.", | |
"city": "Forst", | |
"country": "New Caledonia", | |
"id": 63 | |
}, | |
{ | |
"name": "Myles Shepard", | |
"email": "Nullam.nisl@odio.co.uk", | |
"birthdate": "2015-04-01T16:45:38-07:00", | |
"phonenumber": "0500 626311", | |
"address": "P.O. Box 586, 5606 Ligula Rd.", | |
"city": "North Bay", | |
"country": "Uruguay", | |
"id": 64 | |
}, | |
{ | |
"name": "Logan Ramirez", | |
"email": "a.malesuada.id@a.ca", | |
"birthdate": "2015-07-27T13:15:34-07:00", | |
"phonenumber": "(0112) 168 6457", | |
"address": "5760 Scelerisque Avenue", | |
"city": "Wunstorf", | |
"country": "Syria", | |
"id": 65 | |
}, | |
{ | |
"name": "Palmer Dominguez", | |
"email": "Pellentesque.habitant@risusquis.net", | |
"birthdate": "2015-01-01T12:23:31-08:00", | |
"phonenumber": "(0112) 419 4450", | |
"address": "472-7350 Risus. Rd.", | |
"city": "Sant'Egidio del Monte Albino", | |
"country": "Anguilla", | |
"id": 66 | |
}, | |
{ | |
"name": "Demetrius Hull", | |
"email": "dignissim.pharetra.Nam@Phasellusvitae.net", | |
"birthdate": "2015-01-14T22:17:21-08:00", | |
"phonenumber": "(017342) 56040", | |
"address": "P.O. Box 404, 7817 A, Rd.", | |
"city": "Martello/Martell", | |
"country": "Saint Barthélemy", | |
"id": 67 | |
}, | |
{ | |
"name": "Kenyon Mckinney", | |
"email": "justo.sit@etrisusQuisque.ca", | |
"birthdate": "2014-03-12T01:29:47-07:00", | |
"phonenumber": "0845 46 46", | |
"address": "Ap #875-5976 Eu Rd.", | |
"city": "Lisieux", | |
"country": "San Marino", | |
"id": 68 | |
}, | |
{ | |
"name": "Cooper Mcdonald", | |
"email": "cubilia@interdum.com", | |
"birthdate": "2014-03-15T23:25:52-07:00", | |
"phonenumber": "0800 144367", | |
"address": "P.O. Box 759, 8826 Sem Avenue", | |
"city": "Serrungarina", | |
"country": "Liechtenstein", | |
"id": 69 | |
}, | |
{ | |
"name": "Neville Downs", | |
"email": "morbi.tristique@Pellentesque.co.uk", | |
"birthdate": "2014-09-28T08:53:29-07:00", | |
"phonenumber": "0800 881 4623", | |
"address": "1055 Mattis. Ave", | |
"city": "Lives-sur-Meuse", | |
"country": "Syria", | |
"id": 70 | |
}, | |
{ | |
"name": "Jared Guerra", | |
"email": "iaculis@Aliquam.co.uk", | |
"birthdate": "2015-01-16T04:50:56-08:00", | |
"phonenumber": "0320 033 0369", | |
"address": "P.O. Box 769, 7925 Nulla Av.", | |
"city": "Marentino", | |
"country": "United States Minor Outlying Islands", | |
"id": 71 | |
}, | |
{ | |
"name": "Jelani Caldwell", | |
"email": "tempor@Aeneaneuismod.org", | |
"birthdate": "2014-12-11T04:36:31-08:00", | |
"phonenumber": "(0117) 961 2579", | |
"address": "P.O. Box 123, 1384 Lacus. Av.", | |
"city": "Saint-Eug?ne-de-Ladri?re", | |
"country": "Côte D'Ivoire (Ivory Coast)", | |
"id": 72 | |
}, | |
{ | |
"name": "Lee Massey", | |
"email": "molestie.sodales.Mauris@quisdiamluctus.com", | |
"birthdate": "2014-09-16T14:12:56-07:00", | |
"phonenumber": "(013901) 66557", | |
"address": "480-3005 Rutrum Avenue", | |
"city": "Castel Baronia", | |
"country": "Heard Island and Mcdonald Islands", | |
"id": 73 | |
}, | |
{ | |
"name": "Paki Day", | |
"email": "non@hendrerit.com", | |
"birthdate": "2014-09-06T04:52:32-07:00", | |
"phonenumber": "(01199) 98027", | |
"address": "P.O. Box 583, 6596 Nec Avenue", | |
"city": "Katowice", | |
"country": "Mauritania", | |
"id": 74 | |
}, | |
{ | |
"name": "Kermit Graham", | |
"email": "Vivamus.sit.amet@Suspendisseeleifend.co.uk", | |
"birthdate": "2014-12-21T07:56:19-08:00", | |
"phonenumber": "0800 610 2672", | |
"address": "P.O. Box 225, 4025 Pede. Street", | |
"city": "Fayetteville", | |
"country": "Ethiopia", | |
"id": 75 | |
}, | |
{ | |
"name": "Herman Bullock", | |
"email": "Suspendisse.non.leo@placeratvelit.com", | |
"birthdate": "2014-05-02T13:53:06-07:00", | |
"phonenumber": "(01952) 892875", | |
"address": "P.O. Box 163, 1169 Blandit. St.", | |
"city": "Winterswijk", | |
"country": "France", | |
"id": 76 | |
}, | |
{ | |
"name": "Roth Emerson", | |
"email": "pellentesque.tellus@ut.com", | |
"birthdate": "2015-01-20T08:07:50-08:00", | |
"phonenumber": "055 7324 7181", | |
"address": "P.O. Box 573, 283 Lorem Road", | |
"city": "Coimbatore", | |
"country": "Greece", | |
"id": 77 | |
}, | |
{ | |
"name": "Arsenio Oneill", | |
"email": "Cras.vulputate.velit@bibendumfermentummetus.net", | |
"birthdate": "2014-05-05T08:53:28-07:00", | |
"phonenumber": "056 2045 5477", | |
"address": "Ap #859-4514 Ipsum Street", | |
"city": "Compiègne", | |
"country": "Djibouti", | |
"id": 78 | |
}, | |
{ | |
"name": "Armando Mcclain", | |
"email": "Donec.tempus.lorem@quispedeSuspendisse.ca", | |
"birthdate": "2015-02-04T10:32:18-08:00", | |
"phonenumber": "0903 248 0921", | |
"address": "Ap #280-4254 Molestie Road", | |
"city": "Corroy-le-Grand", | |
"country": "Venezuela", | |
"id": 79 | |
}, | |
{ | |
"name": "Reece Russell", | |
"email": "tincidunt.Donec@gravidamolestiearcu.org", | |
"birthdate": "2014-12-16T12:10:13-08:00", | |
"phonenumber": "(016977) 8647", | |
"address": "Ap #938-990 Molestie Avenue", | |
"city": "Savannah", | |
"country": "Denmark", | |
"id": 80 | |
}, | |
{ | |
"name": "Axel Collins", | |
"email": "congue.elit@Cras.com", | |
"birthdate": "2014-08-26T20:58:30-07:00", | |
"phonenumber": "(026) 1532 8962", | |
"address": "P.O. Box 537, 427 Id, Street", | |
"city": "Carmen", | |
"country": "Kiribati", | |
"id": 81 | |
}, | |
{ | |
"name": "Allistair Whitney", | |
"email": "risus@sedleo.net", | |
"birthdate": "2014-11-17T11:08:12-08:00", | |
"phonenumber": "07624 779131", | |
"address": "P.O. Box 360, 787 Proin Street", | |
"city": "Les Bulles", | |
"country": "Paraguay", | |
"id": 82 | |
}, | |
{ | |
"name": "Galvin Abbott", | |
"email": "ante@Cras.org", | |
"birthdate": "2014-03-31T08:10:06-07:00", | |
"phonenumber": "(029) 7142 7580", | |
"address": "P.O. Box 710, 1213 Purus. Avenue", | |
"city": "L�beck", | |
"country": "Curaçao", | |
"id": 83 | |
}, | |
{ | |
"name": "Ulysses Barker", | |
"email": "pede.nec.ante@risus.net", | |
"birthdate": "2015-09-19T17:56:33-07:00", | |
"phonenumber": "(029) 2974 9383", | |
"address": "814-7753 Aenean Street", | |
"city": "C�roux-Mousty", | |
"country": "Belgium", | |
"id": 84 | |
}, | |
{ | |
"name": "Zahir Murphy", | |
"email": "velit.Cras@Suspendissecommodo.com", | |
"birthdate": "2015-04-15T18:46:52-07:00", | |
"phonenumber": "0500 179410", | |
"address": "P.O. Box 706, 300 Nunc Ave", | |
"city": "Alviano", | |
"country": "Slovenia", | |
"id": 85 | |
}, | |
{ | |
"name": "Marsden Sellers", | |
"email": "laoreet.posuere@nonummy.co.uk", | |
"birthdate": "2014-10-06T08:19:35-07:00", | |
"phonenumber": "(0110) 030 3507", | |
"address": "Ap #841-1004 Nonummy Street", | |
"city": "Bonnert", | |
"country": "Italy", | |
"id": 86 | |
}, | |
{ | |
"name": "Hashim Rich", | |
"email": "magna.a.neque@elitsed.co.uk", | |
"birthdate": "2015-05-02T08:50:20-07:00", | |
"phonenumber": "056 9792 6949", | |
"address": "8873 Quam St.", | |
"city": "South Portland", | |
"country": "Algeria", | |
"id": 87 | |
}, | |
{ | |
"name": "Akeem Pena", | |
"email": "libero.at@aliquameuaccumsan.net", | |
"birthdate": "2014-05-06T06:31:10-07:00", | |
"phonenumber": "0845 46 47", | |
"address": "P.O. Box 893, 7753 Nunc. Road", | |
"city": "Essex", | |
"country": "Solomon Islands", | |
"id": 88 | |
}, | |
{ | |
"name": "Ronan Lynch", | |
"email": "neque.sed.sem@nonhendrerit.com", | |
"birthdate": "2015-09-10T02:34:07-07:00", | |
"phonenumber": "0500 969779", | |
"address": "570 Aliquam St.", | |
"city": "Oristano", | |
"country": "Sweden", | |
"id": 89 | |
}, | |
{ | |
"name": "Harding Williams", | |
"email": "eu@infaucibus.co.uk", | |
"birthdate": "2014-09-17T18:35:26-07:00", | |
"phonenumber": "(023) 6447 0695", | |
"address": "344-8254 Vestibulum Ave", | |
"city": "Proddatur", | |
"country": "Saint Pierre and Miquelon", | |
"id": 90 | |
}, | |
{ | |
"name": "Oren Duke", | |
"email": "a.malesuada@augueacipsum.ca", | |
"birthdate": "2015-11-24T06:30:40-08:00", | |
"phonenumber": "0500 109077", | |
"address": "P.O. Box 867, 8572 Ut Av.", | |
"city": "Gary", | |
"country": "Turkmenistan", | |
"id": 91 | |
}, | |
{ | |
"name": "Chaim Barton", | |
"email": "enim.sit@malesuadafringilla.ca", | |
"birthdate": "2014-06-05T13:51:08-07:00", | |
"phonenumber": "0845 46 47", | |
"address": "P.O. Box 451, 4763 Pretium Rd.", | |
"city": "Pescantina", | |
"country": "French Polynesia", | |
"id": 92 | |
}, | |
{ | |
"name": "Arsenio Dillon", | |
"email": "magna.Phasellus@sitamet.com", | |
"birthdate": "2014-10-02T01:03:55-07:00", | |
"phonenumber": "0500 882919", | |
"address": "270-7226 Aenean St.", | |
"city": "Maubeuge", | |
"country": "Ukraine", | |
"id": 93 | |
}, | |
{ | |
"name": "Dolan Leon", | |
"email": "neque.Sed@ipsum.ca", | |
"birthdate": "2016-02-19T13:26:22-08:00", | |
"phonenumber": "0800 915 5967", | |
"address": "Ap #448-1741 Orci, Rd.", | |
"city": "Sterling Heights", | |
"country": "Heard Island and Mcdonald Islands", | |
"id": 94 | |
}, | |
{ | |
"name": "Griffin Lyons", | |
"email": "lectus.a@eleifend.edu", | |
"birthdate": "2014-11-26T18:50:08-08:00", | |
"phonenumber": "(016977) 9967", | |
"address": "P.O. Box 503, 9642 Curabitur Road", | |
"city": "Westmount", | |
"country": "Slovakia", | |
"id": 95 | |
}, | |
{ | |
"name": "Maxwell Garcia", | |
"email": "eget.mollis@maurisrhoncusid.co.uk", | |
"birthdate": "2014-08-03T18:25:28-07:00", | |
"phonenumber": "0800 1111", | |
"address": "Ap #334-6276 Massa. Rd.", | |
"city": "Hilo", | |
"country": "Antarctica", | |
"id": 96 | |
}, | |
{ | |
"name": "Aladdin Washington", | |
"email": "tempor@ultricesiaculis.co.uk", | |
"birthdate": "2014-09-21T09:41:31-07:00", | |
"phonenumber": "0500 493094", | |
"address": "Ap #826-7635 Cursus Rd.", | |
"city": "Oppido Mamertina", | |
"country": "Russian Federation", | |
"id": 97 | |
}, | |
{ | |
"name": "Cameron Randolph", | |
"email": "erat@sagittisplacerat.net", | |
"birthdate": "2014-05-29T20:30:42-07:00", | |
"phonenumber": "0971 952 2726", | |
"address": "1752 Nunc Avenue", | |
"city": "Nandyal", | |
"country": "French Southern Territories", | |
"id": 98 | |
}, | |
{ | |
"name": "Davis Fitzpatrick", | |
"email": "auctor.nunc.nulla@euismod.edu", | |
"birthdate": "2014-11-15T00:32:25-08:00", | |
"phonenumber": "0800 1111", | |
"address": "291-5376 Dis Av.", | |
"city": "Pomarolo", | |
"country": "Nauru", | |
"id": 99 | |
}, | |
{ | |
"name": "Chaney Sargent", | |
"email": "placerat.velit@atauctor.com", | |
"birthdate": "2015-02-21T10:33:40-08:00", | |
"phonenumber": "0348 086 8148", | |
"address": "P.O. Box 835, 3488 Suspendisse Ave", | |
"city": "Ganganagar", | |
"country": "Tanzania", | |
"id": 100 | |
} | |
]""" | |
PERSONS = json.loads(PERSONS) | |
@app.route('/api/v1/person', method='GET') | |
def person_list(): | |
response.content_type = 'application/json' | |
response.headers['Access-Control-Allow-Origin'] = '*' | |
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS' | |
response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' | |
return json.dumps(PERSONS) | |
@route('/api/v1/person/<id>', method='GET') | |
def person_get_detail(id): | |
for person in PERSONS: | |
if person['id'] == int(id): | |
return person | |
@app.route('/api/v1/person/<id>', method='PUT') | |
def person_update_person(id): | |
for person in PERSONS: | |
if person['id'] == int(id): | |
person['name'] = request.POST.get("name") | |
person['name'] = request.POST.get("name") | |
person['name'] = request.POST.get("name") | |
person['name'] = request.POST.get("name") | |
person['name'] = request.POST.get("name") | |
person['name'] = request.POST.get("name") | |
@app.route('/slow_load.js', method=['GET']) | |
def slow_load(): | |
if request.method == 'OPTIONS': | |
return {} | |
time.sleep(15) | |
response.status=200 | |
return '' | |
@app.route('/slow_load.js') | |
def slow_load(): | |
time.sleep(5) | |
return static_file('dummy.js', root='.', mimetype='application/javascript') | |
@app.route('/register/', method=['OPTIONS', 'POST']) | |
def form_register(): | |
if request.method == 'OPTIONS': | |
return {} | |
time.sleep(5) | |
data = json.load(request.body) | |
name = data.get("name") | |
if "error" in name.lower(): | |
response.status=400 | |
response.body=json.dumps({'name': "Can't register with a name containing the string 'error'"}) | |
else: | |
response.status=200 | |
app.run(host='0.0.0.0', port=argv[1], debug=True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment