Skip to content

Commit

Permalink
add X-Connector-Id header to all connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
walterbm-cohere committed Dec 5, 2023
1 parent e00cde2 commit 9be370a
Show file tree
Hide file tree
Showing 160 changed files with 172 additions and 82 deletions.
1 change: 1 addition & 0 deletions _template_/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
# load environment variables prefixed with the name of the current directory
config_prefix = os.path.split(os.getcwd())[1].upper().replace("_", "")
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion _template_/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def search(body):
},
]

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


# This function is run for all endpoints to ensure requests are using a valid API key
Expand Down
1 change: 1 addition & 0 deletions agilitycms/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion agilitycms/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"AgilityCMS config error: {error}")
abort(502, f"AgilityCMS config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions agora/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion agora/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Agora config error: {error}")
abort(502, f"Agora config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions aha/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion aha/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def search(body):
logger.error(f"Aha config error: {error}")
abort(502, f"Aha config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions algolia/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
flask_app.config.from_mapping(dotenv_values())
return flask_app
2 changes: 1 addition & 1 deletion algolia/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions asana/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion asana/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions atera/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion atera/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions backstage/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion backstage/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def search(body):
except AssertionError as error:
logger.error(f"Solr config error: {error}")
abort(502, f"Solr config error: {error}")
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions basecamp/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion basecamp/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Basecamp config error: {error}")
abort(502, f"Basecamp config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions bigquery/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion bigquery/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions blogger/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def create_app():
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix

return flask_app
2 changes: 1 addition & 1 deletion blogger/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def search(body):
logger.error(f"Blogger config error: {error}")
abort(502, f"Blogger config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions box/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion box/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions cockroach/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion cockroach/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def search(body):
except AssertionError as error:
logger.error(f"Cockroach config error: {error}")
abort(502, f"Cockroach config error: {error}")
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions coda/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion coda/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions confluence/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion confluence/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions contentful/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion contentful/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Contentful config error: {error}")
abort(502, f"Contentful config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions copper/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion copper/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Copper provider error: {error}")
abort(502, f"Copper config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions couchbase/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion couchbase/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def search(body):
logger.error(f"Couchbase config error: {error}")
abort(502, f"Couchbase config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions courier/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion courier/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions discourse/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion discourse/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions docusign/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion docusign/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Docusign config error: {error}")
abort(502, f"Docusign config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions egnyte/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion egnyte/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions elastic/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion elastic/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions fifteenfive/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion fifteenfive/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def search(body):
logger.error(f"GDrive config error: {error}")
abort(502, f"GDrive config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions fireflies/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion fireflies/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"FireFlies config error: {error}")
abort(502, f"FireFlies config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions freshdesk/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion freshdesk/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions freshsales/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
Loading

0 comments on commit 9be370a

Please sign in to comment.