Postal-Methods-2.0-API 2.0

Creator: railscoder56

Last updated:

0 purchases

Postal-Methods-2.0-API 2.0 Image
Postal-Methods-2.0-API 2.0 Images
Add to Cart

Description:

PostalMethods2.0API 2.0

This is the python package for Postal Methods API
It consists of six functions
The class name is PMAPI.
the functions are listed below.
SendLetter(myDescription="",
perforation=False,
replyOnEnvelope=False,
returnAddress=None,
File=None, fileUrl='',
isDoubleSided=False,
isColored=False,
urlFileExtension='',
refId='',
returnAddressPosition=1,
isReturnAddressAppended=False
)
SendLetterWithAddress(myDescription="",
perforation=False,
replyOnEnvelope=False,
returnAddress=None,
sendToAddress=None,
File=None, fileUrl='',
templateId=0,
isDoubleSided=False,
isColored=False,
urlFileExtension='',
refId='',
returnAddressPosition=1,
isReturnAddressAppended=False
)
Takes the Letter Id:
GetPDF(self, RequestId)
Takes a List of Letter Ids:
GetLetterStatus(self, RequestIds)
Takes the Letter Id:
GetLetterDetails(self, RequestId)
Takes the Letter Id:
CancelDelivery(self, RequestId)
Response:
The response object contains three properties

status
errorMessage
result

The status gives you the status code of the request.
The errorMessage will give the error message if the status is not 200
the result will contain the response result.
You can find the result type of each API by looking at the example response result field in the documentation here:
https://documenter.getpostman.com/view/10877655/TVKD3dba
Implementation:
Initialize the PMAPI Class with your API key.
Call functions with their respective params.
Example is given below:
Imports:
from pmpackage import PMAPI

from pmpackage import Address

Initialization:
testReq = PMAPI('api-key')

Status:
Ids = [1,2,3]

response = testReq.GetLetterStatus(Ids)

Detail:
Id = 1

response = testReq.GetLetterDetails(Id)

Cancel:
Id = 1

response = testReq.CancelDelivery(Id)

PDF:
Ids = 1

response = testReq.GetPDF(Id)

SendLetter:
filePath = 'ValidDoc.pdf'
with open(filePath, "rb") as uploadedFile:

# First We Initialize the Address Object
returnAddress = Address('Company', 'AddressLine1', 'AddressLine2',
'City', 'State', 'Zip', 'Country')

response = testReq.SendLetter('Hello',
True,
True,
returnAddress,
uploadedFile,
'', True,
True, '',
'hello123',
2,
True)

Send Letter With Address:
filePath = 'ValidDoc.pdf'
with open(filePath, "rb") as uploadedFile:

# First We Initialize the Address Object
returnAddress = Address('Company', 'AddressLine1', 'AddressLine2',
'City', 'State', 'Zip', 'Country')
SendAddress = Address('', '1300 Montgomery Highway', '',
'Vestavia Hills', 'AL', '35612', None)
hello = checkReq.SendLetterWithAddress('Hello',
True,
True,
returnAddress,
SendAddress,
uploadedFile,
'',
0,
True,
True,
'',
'hello123',
2,
False
)

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.