-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support API KEY for OPENAPI functions (#609)
- Loading branch information
1 parent
07c54bc
commit 477b4ec
Showing
9 changed files
with
258 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== | ||
# Licensed under the Apache License, Version 2.0 (the “License”); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an “AS IS” BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
openapi: 3.0.0 | ||
servers: | ||
- url: https://api.nasa.gov/planetary | ||
- url: http://api.nasa.gov/planetary | ||
info: | ||
contact: | ||
email: evan.t.yates@nasa.gov | ||
description: This endpoint structures the APOD imagery and associated metadata | ||
so that it can be repurposed for other applications. In addition, if the | ||
concept_tags parameter is set to True, then keywords derived from the image | ||
explanation are returned. These keywords could be used as auto-generated | ||
hashtags for twitter or instagram feeds; but generally help with | ||
discoverability of relevant imagery | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
title: APOD | ||
version: 1.0.0 | ||
x-apisguru-categories: | ||
- media | ||
- open_data | ||
x-origin: | ||
- format: swagger | ||
url: https://raw.githubusercontent.com/nasa/api-docs/gh-pages/assets/json/APOD | ||
version: "2.0" | ||
x-providerName: nasa.gov | ||
x-serviceName: apod | ||
tags: | ||
- description: An example tag | ||
externalDocs: | ||
description: Here's a link | ||
url: https://example.com | ||
name: request tag | ||
paths: | ||
/apod: | ||
get: | ||
description: Returns the picture of the day | ||
parameters: | ||
- description: The date of the APOD image to retrieve | ||
in: query | ||
name: date | ||
required: false | ||
schema: | ||
type: string | ||
- description: Retrieve the URL for the high resolution image | ||
in: query | ||
name: hd | ||
required: false | ||
schema: | ||
type: boolean | ||
responses: | ||
"200": | ||
content: | ||
application/json: | ||
schema: | ||
items: | ||
x-thing: ok | ||
type: array | ||
description: successful operation | ||
"400": | ||
description: Date must be between Jun 16, 1995 and Mar 28, 2019. | ||
security: | ||
- api_key: [] | ||
summary: Returns images | ||
tags: | ||
- request tag | ||
components: | ||
securitySchemes: | ||
api_key: | ||
in: query | ||
name: api_key | ||
type: apiKey |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== | ||
# Licensed under the Apache License, Version 2.0 (the “License”); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an “AS IS” BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== | ||
from camel.types import OpenAPIName | ||
|
||
openapi_security_config = { | ||
OpenAPIName.NASA_APOD.value: { | ||
"api_key": "NASA_API_KEY", | ||
"get_api_key_url": "https://api.nasa.gov/", | ||
}, | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -302,4 +302,4 @@ module = [ | |
"pygithub" | ||
|
||
] | ||
ignore_missing_imports = true | ||
ignore_missing_imports = true |
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