Client for the PATS API (www.pats.org.uk)
Project description
Python API wrapper for PATS, the Publishers Advertising Transaction System (http://www.pats.org.uk/)
Currently built for Python 3 only - please let me know if you require Python 2 support.
Installation
Installing from PyPI:
pip install -e git://github.com/bquinn/pats-api-python.git#egg=pats-api-python
Usage
Example:
import pats pats_buyer = pats.PATSAPIClient(api_key=PATS_AGENCY_API_KEY, agency_id=AGENCY_ID) pats_seller = pats.PATSAPIClient(api_key=PATS_PUBLISHER_API_KEY, vendor_id=VENDOR_ID) # create a new campaign campaign_details = pats.CampaignDetails( organisation_id = 'xxxxxx', person_id = 'yyyyy', company_id = 'COMPANYID', campaign_name = 'PATS API test campaign 1', start_date = '2015-02-01', end_date = '2015-02-28', advertiser_code = 'AAB', print_campaign=True, digital_campaign=True, campaign_budget = 1000000, external_campaign_id= 'BQTESTCAMPAIGN1' ) campaign_id = pats_buyer.create_campaign(campaign_details) # returns PATS Campaign ID eg 'CPZVF' insertion_order_details = InsertionOrderDetails( order_id='MyTestOrder-0001', publisher_id=PATS_PUBLISHER_ID, agency_buyer_first_name='Brendan', agency_buyer_last_name='Quinn', agency_buyer_email='brendan@patsbuyer.com', order_number='1111', recipient_emails=['patsdemo@patsseller.com'], terms_and_conditions=[{"name":"Test Ts and Cs", "content":"Test Ts and Cs"}], respond_by_date='2015-01-27', additional_info='No additional info', message='This is the message sent with the order', notify_emails=['brendan@patswatcher.com'] ) line_item_1 = InsertionOrderLineItemDigital( lineNumber="1", externalPlacementId="TestOrder-Monday-PATSTest-1-001", placementName="Sport Banner", costMethod="CPM", unitAmount="2000000", plannedCost="30000.00", unitType="Impressions", section="Sport", subMediaType="Display (Digital)", productId="PATSSPORTBANNER", buyCategory="Standard", packageType="Standalone", site="mysite.co.uk", rate="15.00", flightStart="2015-02-01", flightEnd="2015-02-28", dimensions="468x60", dimensionsPosition="Above the Fold", servedBy="3rd party", bookingCategoryName="Standalone", flighting=[ { "startDate": "2015-02-01", "endDate": "2015-02-28", "unitAmount": 2000000, "plannedCost": "30000.00" } ] ) line_items = [ line_item_1 ] response = pats_buyer.create_order( agency_id=agency_id, company_id=company_id, person_id=person_id, external_campaign_id=external_campaign_id, media_type=media_type, insertion_order_details=insertion_order_details, line_items=line_items ) # returns # { # "status":"SUCCESSFUL", # "fieldValidations":[], # "publicId":"MyTestOrder-0001", # "version":1 # }
Features so far
Buyer side:
Create campaign: create_campaign()
View campaign including RFPs: view_campaign_detail()
RFPs:
Submit RFP submit_rfp() (coming soon)
Submit product-based RFP: submit_product_rfp() (coming soon)
View RFP including proposals: view_rfp_detail(user_email, rfp_id)
Get RFP attachment: get_rfp_attachment(user_email, rfp_id, attachment_id)
Search RFPs: search_rfps()
Get proposal attachment: get_proposal_attachment(user_email, proposal_id, attachment_id)
Return proposal: return_proposal() (coming soon)
Orders:
Create print or digital order against a campaign: create_order()
View orders between dates: view_orders(start_date, end_date)
(NB: “Get order status” is changing for next version)
Return order revision: return_order_revision(order_public_id, order_major_version, order_minor_version, buyer_email, seller_email, revision_due_date, comment)
Product Catalogue:
list products: list_products()
Entity classes:
Constructors for CampaignDetails(), InsertionOrderDetails(), InsertionOrderLineItemPrint(), InsertionOrderLineItemDigital()
Seller side:
Product Catalogue:
add or edit print or digital product: save_product()
list products: list_products()
Orders:
View orders between dates: view_orders(start_date, end_date)
View detail of an order: view_order_detail(order_id)
Accept or reject an order: respond_to_order(user_id, order_id, status, comments)
RFPs:
View RFPs between dates: view_rfps(start_date, end_date)
View proposals for an RFP: view_proposals(rfp_id)
Send proposal against an RFP: send_proposal(rfp_id, proposal_external_id, comments, digital_line_items, print_line_items)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pats-0.13.tar.gz
.
File metadata
- Download URL: pats-0.13.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 287c4e56bd9a2aad140af90a051d5e35590840d1e120c15407e72affde7e09d2 |
|
MD5 | 313b816632c454dbfb335632b9bcd4d1 |
|
BLAKE2b-256 | 80524cabb5722f7586628c6af72f64be0bd177e2043cbfcf3217bc1e23fb023e |