-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from HTTPArchive/development
Adding the Timing-Allow-Origin header.
- Loading branch information
Showing
27 changed files
with
131 additions
and
186 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
import functions_framework | ||
|
||
from .libs.validator import Validator | ||
from .libs.utils import output | ||
from .libs.queries import list_data | ||
from .libs.network import respond_cors | ||
from .libs.network import respond_cors, respond | ||
|
||
@functions_framework.http | ||
def dispatcher(request): | ||
|
||
if request.method == "OPTIONS": | ||
return respond_cors() | ||
|
||
headers = { | ||
"Access-Control-Allow-Origin": "*", | ||
"cache-control": "public, max-age=21600" | ||
} | ||
|
||
args = request.args.to_dict() | ||
|
||
validator = Validator(params=args) | ||
result = validator.validate() | ||
|
||
if result.failure(): | ||
print("error", result.errors) | ||
return output(result) | ||
return respond(result) | ||
|
||
response = list_data(result.result) | ||
|
||
return output(response, headers) | ||
return respond(response) |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
import functions_framework | ||
|
||
from .libs.validator import Validator | ||
from .libs.utils import output | ||
from .libs.queries import list_data | ||
from .libs.network import respond_cors | ||
from .libs.network import respond_cors, respond | ||
|
||
@functions_framework.http | ||
def dispatcher(request): | ||
|
||
if request.method == "OPTIONS": | ||
return respond_cors() | ||
|
||
headers = { | ||
"Access-Control-Allow-Origin": "*", | ||
"cache-control": "public, max-age=21600" | ||
} | ||
|
||
|
||
args = request.args.to_dict() | ||
|
||
validator = Validator(params=args) | ||
result = validator.validate() | ||
|
||
if result.failure(): | ||
print("error", result.errors) | ||
return output(result) | ||
return respond(result) | ||
|
||
response = list_data(result.result) | ||
|
||
return output(response, headers) | ||
return respond(response) |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
import functions_framework | ||
|
||
from .libs.utils import output | ||
from .libs.utils import ( COUNTRIES ) | ||
from .libs.result import Result | ||
from .libs.network import respond_cors | ||
from .libs.network import respond_cors, respond | ||
|
||
@functions_framework.http | ||
def dispatcher(request): | ||
|
||
if request.method == "OPTIONS": | ||
return respond_cors() | ||
|
||
headers = { | ||
"Access-Control-Allow-Origin": "*", | ||
"cache-control": "public, max-age=21600" | ||
} | ||
|
||
|
||
response = Result(result=COUNTRIES) | ||
|
||
return output(response, headers) | ||
return respond(response) |
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
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
Oops, something went wrong.