Skip to content

rgs258/drf_endpoint_examples_client

Repository files navigation

swagger-client

Swagger API Documentation for DRF Endpoint Examples.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
body = swagger_client.Address() # Address |  (optional)

try:
    api_response = api_instance.create_address(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->create_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
body = swagger_client.Customer() # Customer |  (optional)

try:
    api_response = api_instance.create_customer(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->create_customer: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
body = swagger_client.Order() # Order |  (optional)

try:
    api_response = api_instance.create_order(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->create_order: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
body = swagger_client.Product() # Product |  (optional)

try:
    api_response = api_instance.create_product(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->create_product: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
body = swagger_client.Review() # Review |  (optional)

try:
    api_response = api_instance.create_review(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->create_review: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this address.

try:
    api_instance.destroy_address(id)
except ApiException as e:
    print("Exception when calling ApiApi->destroy_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this customer.

try:
    api_instance.destroy_customer(id)
except ApiException as e:
    print("Exception when calling ApiApi->destroy_customer: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this order.

try:
    api_instance.destroy_order(id)
except ApiException as e:
    print("Exception when calling ApiApi->destroy_order: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this product.

try:
    api_instance.destroy_product(id)
except ApiException as e:
    print("Exception when calling ApiApi->destroy_product: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this review.

try:
    api_instance.destroy_review(id)
except ApiException as e:
    print("Exception when calling ApiApi->destroy_review: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))

try:
    api_response = api_instance.list_address()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->list_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))

try:
    api_response = api_instance.list_customers()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->list_customers: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))

try:
    api_response = api_instance.list_orders()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->list_orders: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))

try:
    api_response = api_instance.list_products()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->list_products: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))

try:
    api_response = api_instance.list_reviews()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->list_reviews: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this address.
body = swagger_client.Address() # Address |  (optional)

try:
    api_response = api_instance.partial_update_address(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->partial_update_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this customer.
body = swagger_client.Customer() # Customer |  (optional)

try:
    api_response = api_instance.partial_update_customer(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->partial_update_customer: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this order.
body = swagger_client.Order() # Order |  (optional)

try:
    api_response = api_instance.partial_update_order(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->partial_update_order: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this product.
body = swagger_client.Product() # Product |  (optional)

try:
    api_response = api_instance.partial_update_product(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->partial_update_product: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this review.
body = swagger_client.Review() # Review |  (optional)

try:
    api_response = api_instance.partial_update_review(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->partial_update_review: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this address.

try:
    api_response = api_instance.retrieve_address(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->retrieve_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this customer.

try:
    api_response = api_instance.retrieve_customer(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->retrieve_customer: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this order.

try:
    api_response = api_instance.retrieve_order(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->retrieve_order: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this product.

try:
    api_response = api_instance.retrieve_product(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->retrieve_product: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this review.

try:
    api_response = api_instance.retrieve_review(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->retrieve_review: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this address.
body = swagger_client.Address() # Address |  (optional)

try:
    api_response = api_instance.update_address(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->update_address: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this customer.
body = swagger_client.Customer() # Customer |  (optional)

try:
    api_response = api_instance.update_customer(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->update_customer: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this order.
body = swagger_client.Order() # Order |  (optional)

try:
    api_response = api_instance.update_order(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->update_order: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this product.
body = swagger_client.Product() # Product |  (optional)

try:
    api_response = api_instance.update_product(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->update_product: %s\n" % e)

# Configure API key authorization: TokenAuthentication
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | A unique integer value identifying this review.
body = swagger_client.Review() # Review |  (optional)

try:
    api_response = api_instance.update_review(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiApi->update_review: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
ApiApi create_address POST /api/addresses/
ApiApi create_customer POST /api/customers/
ApiApi create_order POST /api/orders/
ApiApi create_product POST /api/products/
ApiApi create_review POST /api/reviews/
ApiApi destroy_address DELETE /api/addresses/{id}/
ApiApi destroy_customer DELETE /api/customers/{id}/
ApiApi destroy_order DELETE /api/orders/{id}/
ApiApi destroy_product DELETE /api/products/{id}/
ApiApi destroy_review DELETE /api/reviews/{id}/
ApiApi list_address GET /api/addresses/
ApiApi list_customers GET /api/customers/
ApiApi list_orders GET /api/orders/
ApiApi list_products GET /api/products/
ApiApi list_reviews GET /api/reviews/
ApiApi partial_update_address PATCH /api/addresses/{id}/
ApiApi partial_update_customer PATCH /api/customers/{id}/
ApiApi partial_update_order PATCH /api/orders/{id}/
ApiApi partial_update_product PATCH /api/products/{id}/
ApiApi partial_update_review PATCH /api/reviews/{id}/
ApiApi retrieve_address GET /api/addresses/{id}/
ApiApi retrieve_customer GET /api/customers/{id}/
ApiApi retrieve_order GET /api/orders/{id}/
ApiApi retrieve_product GET /api/products/{id}/
ApiApi retrieve_review GET /api/reviews/{id}/
ApiApi update_address PUT /api/addresses/{id}/
ApiApi update_customer PUT /api/customers/{id}/
ApiApi update_order PUT /api/orders/{id}/
ApiApi update_product PUT /api/products/{id}/
ApiApi update_review PUT /api/reviews/{id}/

Documentation For Models

Documentation For Authorization

TokenAuthentication

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

About

Example DRF Endpoints Python Client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published