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
)
Release files for Postal-Methods-2.0-API 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Postal Methods 2.0 API-2.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Postal_Methods_2.0_API-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / Postal Methods 2.0 API-2.0.tar.gz
| Download URL | Postal Methods 2.0 API-2.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
694e18cae421a9449b7a9f676eb7bbe6f45bc9b90bfdb7fb9ddf4574efde9d1a
|
|
BLAKE2b-256 checksum How to use checksums |
13d159e6a557e287ed8f6a92afd5e429ee425f46ae558e203d75b3c73222670d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|
Release files / Postal_Methods_2.0_API-2.0-py3-none-any.whl
| Download URL | Postal_Methods_2.0_API-2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7785eb8d1005f1bc3c5753defdab086ff6297430dfd3ae9aecb9ef0f1f4d173
|
|
BLAKE2b-256 checksum How to use checksums |
96944464c906fce7071b38838eebc49f965592f2212e6a2d844e236b6c68bf59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|