usps-api | Python Wrapper for the USPS API truck package | REST library
kandi X-RAY | usps-api Summary
kandi X-RAY | usps-api Summary
Python Wrapper for the USPS API :truck: :package:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create an EVS request .
- Adds this person to the XML element .
- Send a request to USPS API .
- Construct the URL for a given action .
- Validate an address .
- Create a TrackingInfo object .
usps-api Key Features
usps-api Examples and Code Snippets
Community Discussions
Trending Discussions on usps-api
QUESTION
I am trying to call the USPS Address Validation API from within Google Apps Script. It requires XML, which I am inexperienced with compared to JSON. Here is another stackoverflow question that is similar (How do I get domestic shipping rates via the USPS API using Google Apps Script?), and I have followed it to a "t", but it is different enough and when adapted for the USPS Address Validation API, it is not working for me. I have signed up for a userid and received a confirmation from USPS.
Here is the USPS Address Validation API documentation: https://www.usps.com/business/web-tools-apis/address-information-api.htm#_Toc34052588.
Here is my Apps Script Code (with the USPS userid changed for confidentiality):
...ANSWER
Answered 2020-Apr-19 at 07:38I figured out what the problem was. My only real problem was that I had my closing XML tag incorrect. It should be < /AddressValidateRequest > instead of < /AddressValidationRequest >. You ALSO need to include a self-closing < Address1/ > tag before < Address2 > and < Zip4/ > after < /Zip5 >. It will throw an error if you don't.
However, I'm glad I had the problem and posted it here, so that hopefully this will help others in the future to have the code pretty much the way you'll need it for a USPS Validation request from Google Apps Script. I had not found this anywhere else. Here is the final code, then I'll talk about how I worked with the result below as well.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install usps-api
You can use usps-api like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page