Name | sweego JSON |
Version |
0.0.1
JSON |
| download |
home_page | https://learn.sweego.io/ |
Summary | Sweego API |
upload_time | 2024-05-30 08:37:23 |
maintainer | None |
docs_url | None |
author | Sweego |
requires_python | None |
license | None |
keywords |
sweego
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# sweego
The `sweego` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- Generator version: 7.6.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [OpenAPI Generator Python](https://openapi-generator.tech/docs/generators/python/)
## Requirements.
Python 3.7+
## Getting Started
### Install
```
pip install sweego
```
### Use
In your own code, to use this library to connect and interact with sweego,
you can run the following:
```
# Import base API
from sweego.api_client import ApiClient;
# Import auth API
from sweego.api.auth_api import AuthApi;
# Import an endpoint API
from sweego.api.<ENDPOINT> import <ENDPOINT>;
```
## Auth
Below are example on how to use authentication with provided sdk
### Bearer Token
- **Type**: Bearer authentication
- **Bearer parameter name**: Authentication
- **Location**: HTTP header
#### Retrieve access token
```python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import List;
from pprint import pprint;
from sweego.configuration import Configuration as ApiConfig;
from sweego.api.auth_api import AuthApi;
from sweego.api_client import ApiClient;
from sweego.rest import ApiException;
from sweego import ResponseCreateTokenAuthTokenPost;
# Define api host
configuration = ApiConfig (
host = "https://api.sweego.io"
);
# Enter a context with an instance of the API client
with ApiClient ( configuration ) as api_client:
# Create an instance of the API class
api_instance: AuthApi = AuthApi (
api_client = api_client
);
# Define base auth requirements
grant_type: str = 'password'
username: str = '<USERNAME>'
password: str = '<PASSWORD>'
client_id: str = 'front_web'
try:
# Query auth token
api_response: ResponseCreateTokenAuthTokenPost = api_instance.create_token_auth_token_post (
grant_type = grant_type,
username = username,
password = password,
client_id = client_id
);
print ( "Auth response:\n" );
pprint (
object = api_response.actual_instance,
indent = 4
);
print ( "\n--------------------\n" );
# Assign bearer token to authorization header
api_client.default_headers [ 'Authorization' ] = "Bearer {bearer}".format (
bearer = api_response.actual_instance.access_token
);
except ApiException as err:
print (
"Exception when querying : {err}".format (
err = err
),
file = sys.stderr
);
```
#### Refresh token
```python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import List;
from pprint import pprint;
from sweego.configuration import Configuration as ApiConfig;
from sweego.api.auth_api import AuthApi;
from sweego.api_client import ApiClient;
from sweego.rest import ApiException;
from sweego import ResponseCreateTokenAuthTokenPost;
# Define api host
configuration = ApiConfig (
host = "https://api.sweego.io"
);
# Enter a context with an instance of the API client
with ApiClient ( configuration ) as api_client:
# Create an instance of the API class
api_instance: AuthApi = AuthApi (
api_client = api_client
);
# Define base auth requirements
grant_type: str = 'refresh_token'
refresh_token = '<REFRESH_TOKEN>'
client_id: str = 'front_web'
try:
# Query auth token
api_response: ResponseCreateTokenAuthTokenPost = api_instance.create_token_auth_token_post (
grant_type = grant_type,
refresh_token = refresh_token
client_id = client_id
);
print ( "Auth response:\n" );
pprint (
object = api_response.actual_instance,
indent = 4
);
print ( "\n--------------------\n" );
# Assign bearer token to api client authorization header
api_client.default_headers [ 'Authorization' ] = "Bearer {bearer}".format (
bearer = api_response.actual_instance.access_token
);
except ApiException as err:
print (
"Exception when querying : {err}".format (
err = err
),
file = sys.stderr
);
```
### API Key
- **Type**: API key
- **API key parameter name**: Api-Key
- **Location**: HTTP header
```python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os;
import sys;
from typing import List;
from pprint import pprint;
from sweego.configuration import Configuration as ApiConfig;
from sweego.api.auth_api import AuthApi;
from sweego.api_client import ApiClient;
from sweego.rest import ApiException;
from sweego.models.client_webhook import ClientWebhook as ClientWebhookModel;
from sweego.api.webhook_api import WebhookApi;
# Define api host
configuration = ApiConfig (
host = "https://api.sweego.io"
);
# Enter a context with an instance of the API client
with ApiClient ( configuration ) as api_client:
# Create an instance of the API class
api_instance: AuthApi = AuthApi (
api_client = api_client
);
# Define api key to use
api_key: str = '<API_KEY>';
try:
# Assign key to api client header
api_client.default_headers [ 'Api-Key' ] = api_key;
# Every api is in nana object -> check lib
except ApiException as err:
print (
"Exception when querying : {err}".format (
err = err
),
file = sys.stderr
);
```
## Endpoints principles
Every endpoint on the base API will be translated as a unique api object.
To be able to use these api objec you will need to initiate them using the api_client defined above ([create api client](/docs/sdk/python/python-specifications#authentication))
For example, if you want to use ["/webhooks" endpoint](/docs/sweego/get-webhooks-clients-uuid-client-webhooks-get) :
```python
# Following an auth
from sweego.models.client_webhook import ClientWebhook as ClientWebhookModel;
from sweego.api.webhook_api import WebhookApi;
try:
# Create a Webhook API instance
webhook_api: WebhookApi = WebhookApi (
api_client = api_client
);
# Query client wehooks list
client_webhooks: List [ ClientWebhookModel ] = webhook_api.get_webhooks_clients_uuid_client_webhooks_get (
uuid_client = api_response.actual_instance.sweego_client_id
);
# Print Result
for webhook in client_webhooks:
pprint (
object = webhook.dict(),
indent = 4
);
except ApiException as err:
print (
"Exception when querying : {err}".format (
err = err
),
file = sys.stderr
);
```
Every API object is located in ```sweego.api``` namespace
## Error Handling
sweego.exceptions contains a set of specific exceptions class
Raw data
{
"_id": null,
"home_page": "https://learn.sweego.io/",
"name": "sweego",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Sweego",
"author": "Sweego",
"author_email": "infra@sweego.io",
"download_url": "https://files.pythonhosted.org/packages/22/ce/e8ca8bc8493a2bd0054e30b8457539de5dc50d2bb9a2aed6860c6e44d1cd/sweego-0.0.1.tar.gz",
"platform": null,
"description": "\n# sweego\n\nThe `sweego` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:\n\n- Generator version: 7.6.0\n- Build package: org.openapitools.codegen.languages.PythonClientCodegen\nFor more information, please visit [OpenAPI Generator Python](https://openapi-generator.tech/docs/generators/python/)\n\n## Requirements.\n\nPython 3.7+\n\n\n## Getting Started\n\n### Install \n\n```\npip install sweego\n```\n\n### Use\n\nIn your own code, to use this library to connect and interact with sweego,\nyou can run the following:\n\n```\n# Import base API\nfrom sweego.api_client import ApiClient;\n\n# Import auth API\nfrom sweego.api.auth_api import AuthApi;\n\n# Import an endpoint API\nfrom sweego.api.<ENDPOINT> import <ENDPOINT>;\n```\n\n## Auth\n\nBelow are example on how to use authentication with provided sdk\n\n### Bearer Token \n\n- **Type**: Bearer authentication\n- **Bearer parameter name**: Authentication\n- **Location**: HTTP header\n\n#### Retrieve access token\n```python\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom typing import List;\nfrom pprint import pprint;\n\nfrom sweego.configuration import Configuration as ApiConfig;\nfrom sweego.api.auth_api import AuthApi;\nfrom sweego.api_client import ApiClient;\nfrom sweego.rest import ApiException;\nfrom sweego import ResponseCreateTokenAuthTokenPost;\n\n\n# Define api host\nconfiguration = ApiConfig (\n host = \"https://api.sweego.io\"\n);\n\n\n# Enter a context with an instance of the API client\nwith ApiClient ( configuration ) as api_client:\n # Create an instance of the API class\n api_instance: AuthApi = AuthApi (\n api_client = api_client\n );\n\n # Define base auth requirements\n grant_type: str = 'password'\n username: str = '<USERNAME>'\n password: str = '<PASSWORD>'\n client_id: str = 'front_web'\n\n try:\n # Query auth token\n api_response: ResponseCreateTokenAuthTokenPost = api_instance.create_token_auth_token_post (\n grant_type = grant_type,\n username = username,\n password = password,\n client_id = client_id\n );\n \n print ( \"Auth response:\\n\" );\n pprint (\n object = api_response.actual_instance,\n indent = 4\n );\n print ( \"\\n--------------------\\n\" );\n\n # Assign bearer token to authorization header\n api_client.default_headers [ 'Authorization' ] = \"Bearer {bearer}\".format (\n bearer = api_response.actual_instance.access_token\n );\n\n except ApiException as err:\n print (\n \"Exception when querying : {err}\".format (\n err = err\n ),\n file = sys.stderr\n );\n```\n\n\n#### Refresh token\n```python\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom typing import List;\nfrom pprint import pprint;\n\nfrom sweego.configuration import Configuration as ApiConfig;\nfrom sweego.api.auth_api import AuthApi;\nfrom sweego.api_client import ApiClient;\nfrom sweego.rest import ApiException;\nfrom sweego import ResponseCreateTokenAuthTokenPost;\n\n\n# Define api host\nconfiguration = ApiConfig (\n host = \"https://api.sweego.io\"\n);\n\n\n# Enter a context with an instance of the API client\nwith ApiClient ( configuration ) as api_client:\n # Create an instance of the API class\n api_instance: AuthApi = AuthApi (\n api_client = api_client\n );\n\n # Define base auth requirements\n grant_type: str = 'refresh_token'\n refresh_token = '<REFRESH_TOKEN>'\n client_id: str = 'front_web'\n\n try:\n # Query auth token\n api_response: ResponseCreateTokenAuthTokenPost = api_instance.create_token_auth_token_post (\n grant_type = grant_type,\n refresh_token = refresh_token\n client_id = client_id\n );\n \n print ( \"Auth response:\\n\" );\n pprint (\n object = api_response.actual_instance,\n indent = 4\n );\n print ( \"\\n--------------------\\n\" );\n\n # Assign bearer token to api client authorization header\n api_client.default_headers [ 'Authorization' ] = \"Bearer {bearer}\".format (\n bearer = api_response.actual_instance.access_token\n );\n\n except ApiException as err:\n print (\n \"Exception when querying : {err}\".format (\n err = err\n ),\n file = sys.stderr\n );\n```\n\n\n### API Key\n\n- **Type**: API key\n- **API key parameter name**: Api-Key\n- **Location**: HTTP header\n\n```python\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os;\nimport sys;\n\nfrom typing import List;\nfrom pprint import pprint;\n\nfrom sweego.configuration import Configuration as ApiConfig;\nfrom sweego.api.auth_api import AuthApi;\nfrom sweego.api_client import ApiClient;\nfrom sweego.rest import ApiException;\nfrom sweego.models.client_webhook import ClientWebhook as ClientWebhookModel;\nfrom sweego.api.webhook_api import WebhookApi;\n\n# Define api host\nconfiguration = ApiConfig (\n host = \"https://api.sweego.io\"\n);\n\n\n# Enter a context with an instance of the API client\nwith ApiClient ( configuration ) as api_client:\n # Create an instance of the API class\n api_instance: AuthApi = AuthApi (\n api_client = api_client\n );\n\n # Define api key to use\n api_key: str = '<API_KEY>';\n\n try:\n # Assign key to api client header\n api_client.default_headers [ 'Api-Key' ] = api_key;\n\n # Every api is in nana object -> check lib\n except ApiException as err:\n print (\n \"Exception when querying : {err}\".format (\n err = err\n ),\n file = sys.stderr\n );\n```\n\n## Endpoints principles\n\nEvery endpoint on the base API will be translated as a unique api object.\nTo be able to use these api objec you will need to initiate them using the api_client defined above ([create api client](/docs/sdk/python/python-specifications#authentication))\n\nFor example, if you want to use [\"/webhooks\" endpoint](/docs/sweego/get-webhooks-clients-uuid-client-webhooks-get) : \n```python\n# Following an auth\nfrom sweego.models.client_webhook import ClientWebhook as ClientWebhookModel;\nfrom sweego.api.webhook_api import WebhookApi;\n\ntry:\n # Create a Webhook API instance\n webhook_api: WebhookApi = WebhookApi (\n api_client = api_client\n );\n\n\n # Query client wehooks list\n client_webhooks: List [ ClientWebhookModel ] = webhook_api.get_webhooks_clients_uuid_client_webhooks_get (\n uuid_client = api_response.actual_instance.sweego_client_id\n );\n\n\n # Print Result\n for webhook in client_webhooks:\n pprint (\n object = webhook.dict(),\n indent = 4\n );\n\nexcept ApiException as err:\n print (\n \"Exception when querying : {err}\".format (\n err = err\n ),\n file = sys.stderr\n );\n```\n\nEvery API object is located in ```sweego.api``` namespace\n\n\n## Error Handling\n\nsweego.exceptions contains a set of specific exceptions class\n",
"bugtrack_url": null,
"license": null,
"summary": "Sweego API",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://learn.sweego.io/"
},
"split_keywords": [
"sweego"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "69c19782fe60de4365187a252840cb1752a1247429cc7fa2bfb58abe91e558f5",
"md5": "48c42187101f48b416e3e875a5dea94f",
"sha256": "4f378066518d334fe769b01ebc6a5dc5a622b3518b571e4f200262c50936ee05"
},
"downloads": -1,
"filename": "sweego-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "48c42187101f48b416e3e875a5dea94f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 637101,
"upload_time": "2024-05-30T08:37:20",
"upload_time_iso_8601": "2024-05-30T08:37:20.207002Z",
"url": "https://files.pythonhosted.org/packages/69/c1/9782fe60de4365187a252840cb1752a1247429cc7fa2bfb58abe91e558f5/sweego-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22cee8ca8bc8493a2bd0054e30b8457539de5dc50d2bb9a2aed6860c6e44d1cd",
"md5": "0ed9004ca16e0ffa84d81d67774f7a1b",
"sha256": "be536c18f25acc80b9854be7f2d117b143d71804ec4a209bacda844c077178bd"
},
"downloads": -1,
"filename": "sweego-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0ed9004ca16e0ffa84d81d67774f7a1b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 178598,
"upload_time": "2024-05-30T08:37:23",
"upload_time_iso_8601": "2024-05-30T08:37:23.530048Z",
"url": "https://files.pythonhosted.org/packages/22/ce/e8ca8bc8493a2bd0054e30b8457539de5dc50d2bb9a2aed6860c6e44d1cd/sweego-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-30 08:37:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sweego"
}