Skip to content

GallardoSolutions/psrestful_python_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

psrestful

A proxy service for PromoStandards SOAP to a REST API

This package is a client to PSRESTful API

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

  • API version: 0.0.1
  • 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

pip install git+https://github.com/GallardoSolutions/psrestful_python_client.git

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

Then import the package:

import psrestful 

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 psrestful

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
from datetime import datetime, timedelta
import os
import psrestful
from psrestful.rest import ApiException
from pprint import pprint

PSRESTFUL_API_KEY = os.environ.get('PSRESTFUL_API_KEY')   # YOUR_API_KEY

# Configure API key authorization: APIKeyHeader
configuration = psrestful.Configuration()
configuration.api_key['X-API-Key'] = PSRESTFUL_API_KEY
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

# configuration.api_key_prefix['X-API-Key'] = 'Bearer'# Configure HTTP basic authorization: HTTPBasic
configuration = psrestful.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = psrestful.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

#
supplier_code = 'Ariel'
api_version = '2.0.0'
product_id = 'ALB-BT24'
body = None
x_forwarded_for = None
x_account_id = None
product_id_type = None
environment = 'PROD'
now = datetime.now()
last_week = now - timedelta(days=7)

# create an instance of the API class
api_instance = psrestful.InventoryApi(psrestful.ApiClient(configuration))
try:
    # Get Inventory Levels
    api_response = api_instance.get_inventory_by_product_v200(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling InventoryApi->get_inventory_by_product_v200: %s\n" % e)

# Product Data    
api_instance = psrestful.ProductDataApi(psrestful.ApiClient(configuration))

# Get Product Sellable
try:
    api_response = api_instance.get_product_sellable_v200(supplier_code, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductDataApi->get_product_sellable_v200: %s\n" % e)

# Get Product Closeout
try:
    api_response = api_instance.get_product_closeout_v200(supplier_code, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductDataApi->get_product_closeout_v200: %s\n" % e)

# Get Product Modified Since
try:
    api_response = api_instance.get_product_date_modified_v200(since=last_week, supplier_code=supplier_code,
                                                               async_req=False)
    print(api_response)
except ApiException as e:
    print("Exception when calling ProductDataApi->get_product_date_modified_v200: %s\n" % e)

# Get Product
try:
    api_response = api_instance.get_product_v200(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductDataApi->get_product: %s\n" % e)

# Get Media Content
api_instance = psrestful.MediaContentApi(psrestful.ApiClient(configuration))
try:
    api_response = api_instance.get_media_content(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling MediaContentApi->get_media_content: %s\n" % e)

try:
    api_response = api_instance.get_media_date_modified(supplier_code, since=last_week, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling MediaContentApi->get_media_date_modified: %s\n" % e)

# PPC
api_instance = psrestful.ProductPriceAndConfigurationApi(psrestful.ApiClient(configuration))

# get available locations
try:
    api_response = api_instance.get_available_locations(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductPriceAndConfigurationApi->get_available_locations: %s\n" % e)

# get available charges
try:
    api_response = api_instance.get_available_charges(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductPriceAndConfigurationApi->get_available_charges: %s\n" % e)

# get fob points
try:
    api_response = api_instance.get_fob_points(supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductPriceAndConfigurationApi->get_fob_points: %s\n" % e)

# get decoration colors
try:
    api_response = api_instance.get_decoration_colors(location_id=6791, supplier_code=supplier_code,
                                                      product_id=product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductPriceAndConfigurationApi->get_decoration_colors: %s\n" % e)

# get configuration and pricing
try:
    api_response = api_instance.get_configuration_and_pricing('USD', 'MO63114', 'Net',
                                                              supplier_code, product_id, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ProductPriceAndConfigurationApi->get_configuration_and_pricing: %s\n" % e)

# Order Status
api_instance = psrestful.OrderStatusApi(psrestful.ApiClient(configuration))
try:
    api_response = api_instance.get_order_status_details_v100(query_type=4, supplier_code=supplier_code,
                                                              async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling OrderStatusApi->get_order_status_details_v100: %s\n" % e)

# Invoice
api_instance = psrestful.InvoiceApi(psrestful.ApiClient(configuration))
try:
    api_response = api_instance.get_invoices(query_type=4, supplier_code=supplier_code, async_req=False)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling InvoiceApi->get_invoices: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.psrestful.com/

Class Method HTTP request Description
InventoryApi get_filter_values GET /v{api_version}/suppliers/{supplier_code}/inventory/filter-values/{product_id} Get Filter Values
InventoryApi get_inventory_by_product_v121 GET /v1.2.1/suppliers/{supplier_code}/inventory/{product_id} Get Inventory By Product V121
InventoryApi get_inventory_by_product_v200 GET /v2.0.0/suppliers/{supplier_code}/inventory/{product_id} Get Inventory By Product V200
InvoiceApi get_invoices GET /v1.0.0/suppliers/{supplier_code}/invoices/ Get Invoices
InvoiceApi get_voided_invoices GET /v1.0.0/suppliers/{supplier_code}/voided-invoices/ Get Voided Invoices
MediaContentApi get_media_content GET /v1.1.0/suppliers/{supplier_code}/medias/{product_id} Get Media Content
MediaContentApi get_media_date_modified GET /v1.1.0/suppliers/{supplier_code}/media-modified-since/ Get Media Date Modified
OrderShipmentNotificationApi get_order_shipment_notification_v100 GET /v1.0.0/suppliers/{supplier_code}/order-shipment-notifications/ Get Order Shipment Notification V100
OrderShipmentNotificationApi get_order_shipment_notification_v200 GET /v2.0.0/suppliers/{supplier_code}/order-shipment-notifications/ Get Order Shipment Notification V200
OrderStatusApi get_issue_v200 GET /v2.0.0/suppliers/{supplier_code}/issues/{issue_id}/ Get Issue
OrderStatusApi get_order_status_details_v100 GET /v1.0.0/suppliers/{supplier_code}/order-status-details/ Get Order Status Details
OrderStatusApi get_order_status_types_v100 GET /v1.0.0/suppliers/{supplier_code}/order-status-types/ Get Order Status Types
OrderStatusApi get_order_status_v200 GET /v2.0.0/suppliers/{supplier_code}/order-status/ Get Order Status
OrderStatusApi get_service_methods_v200 GET /v2.0.0/suppliers/{supplier_code}/service-methods/ Get Service Methods
ProductDataApi get_product_closeout_v100 GET /v1.0.0/suppliers/{supplier_code}/products-closeout Get Product Closeout V100
ProductDataApi get_product_closeout_v200 GET /v2.0.0/suppliers/{supplier_code}/products-closeout Get Product Closeout V200
ProductDataApi get_product_date_modified_v100 GET /v1.0.0/suppliers/{supplier_code}/products-modified-since Get Product Date Modified V100
ProductDataApi get_product_date_modified_v200 GET /v2.0.0/suppliers/{supplier_code}/products-modified-since Get Product Date Modified V200
ProductDataApi get_product_v200 GET /v2.0.0/suppliers/{supplier_code}/products/{product_id} Get Product V200
ProductPriceAndConfigurationApi get_available_charges GET /v1.0.0/suppliers/{supplier_code}/available-charges/{product_id} Get Available Charges
ProductPriceAndConfigurationApi get_available_locations GET /v1.0.0/suppliers/{supplier_code}/available-locations/{product_id} Get Available Locations
ProductPriceAndConfigurationApi get_configuration_and_pricing GET /v1.0.0/suppliers/{supplier_code}/pricing-and-configuration/{product_id} Get Configuration And Pricing
ProductPriceAndConfigurationApi get_decoration_colors GET /v1.0.0/suppliers/{supplier_code}/decoration-colors/{product_id} Get Decoration Colors
ProductPriceAndConfigurationApi get_fob_points GET /v1.0.0/suppliers/{supplier_code}/fob-points/{product_id} Get Fob Points
PurchaseOrderApi get_supported_order_types GET /v1.0.0/suppliers/{supplier_code}/supported-order-types/ Get Supported Order Types
PurchaseOrderApi send_po POST /v1.0.0/suppliers/{supplier_code}/purchase-orders/ Send Po
DefaultApi get_service_codes GET /service-codes Get Service Codes
DefaultApi get_services GET /services/{supplier_code} Get Services

Documentation For Models

Documentation For Authorization

APIKeyHeader

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

HTTPBasic

  • Type: HTTP basic authentication

OAuth2PasswordBearer

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes:

Author

Edilio Gallardo

About

An SDK in Python to interact with PSRESTful API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages