fix(python): correct shipment and smart_rate service names in examples - #232
Open
Sameer Kumar (sameerkumar18) wants to merge 1 commit into
Open
fix(python): correct shipment and smart_rate service names in examples#232Sameer Kumar (sameerkumar18) wants to merge 1 commit into
Sameer Kumar (sameerkumar18) wants to merge 1 commit into
Conversation
Two Python examples reference client properties that do not exist on
EasyPostClient, so they raise AttributeError when run as published:
- pagination/get-next-page.py used `client.shipments.get_next_page(...)`;
the service is `self.shipment`. The same file already calls
`client.shipment.all()` two lines earlier, so it was internally
inconsistent.
- smartrate/retrieve-standalone-smartrate-deliver-{by,on}.py used
`client.smartrate.*`; the service is `self.smart_rate`. The service
class is `SmartRateService` (in smartrate_service.py), which is the
likely source of the confusion.
Verified against easypost-python v10.7.0 (current PyPI release) and the
v8.2.1/v9.5.0 tags, so the v8 and v9 example directories are affected too.
The client defines no __getattr__ or aliases, so these are hard failures
rather than tolerated spellings.
The methods themselves were correct: `get_next_page` exists on
ShipmentService, and `estimate_delivery_date`/`recommend_ship_date` on
SmartRateService. Only the property names were wrong.
Sameer Kumar (sameerkumar18)
marked this pull request as ready for review
August 24, 2026 08:35
Sameer Kumar (sameerkumar18)
requested a review
from Justin Hammond (Justintime50)
August 24, 2026 08:35
Justin Hammond (Justintime50)
approved these changes
Aug 24, 2026
Justin Hammond (Justintime50)
left a comment
Member
There was a problem hiding this comment.
Nice catch, these were renamed in the last couple versions but examples apparently never updated. Please verify there are no changes needed in the UPGRADE_GUIDE of the python lib to accompany these.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while working DOCS-527 / #231. Same class of bug, different examples and different docs pages, so raised separately. No Jira ticket yet — happy to file one if you'd like it tracked.
The bugs
Two published Python examples reference client properties that do not exist on
EasyPostClient, so they raiseAttributeErrorwhen run as-is.1.
client.shipments→client.shipmentpagination/get-next-page.py#L11— renders on docs.easypost.com/docs/paginationThe file was internally inconsistent — it already used the correct property two lines earlier:
Note
shipmentsis also a local variable here, so this needed a targeted fix rather than a rename.2.
client.smartrate→client.smart_rate…-deliver-by.py#L5and…-deliver-on.py#L5— render on docs.easypost.com/docs/smartrateThe service class is
SmartRateService, defined insmartrate_service.py— the filename not matching the property is the likely source of the confusion.Verification
Checked against
easypost-pythonv10.7.0, the current PyPI release (confirmed via the PyPI JSON API;masterand thev10.7.0tag are identical here):self.shipmentsorself.smartrateproperty exists inv8.2.1,v9.5.0, orv10.7.0.__getattr__,__getattribute__,setattr, or aliasing, so these are hard failures rather than tolerated spellings.get_next_pageexists onShipmentService;estimate_delivery_dateandrecommend_ship_dateonSmartRateService. Only the property names were wrong.client.shipmentandclient.smart_rate, matching Ruby'sto_snake_case(ClassName)derivation.Scope
7 occurrences across 7 files (
current,v9,v8):shipments→shipmentsmartrate→smart_ratev8has no smartrate deliver-by/on examples because those methods landed in v9.3.0 — that absence is correct, not a gap.self.shipmentis present as far back as v8.2.1, so the v8 pagination fix is valid for its version.Only
currentis rendered on the docs site (it importspython/current/exclusively), so the v8/v9 files can be trimmed from this PR if you'd rather limit it to the rendered surface.Result
I validated every
client.<service>reference inofficial/docs/python/current/against the live service list fromEasyPostClient. Three properties were invalid; this PR fixes two and #231 fixes the third (api_key→api_keys). Together the two PRs bringpython/current/to zero invalid service references.Checks
python3 -m py_compilepasses on all 7 filesshipmentsvariable in the pagination example verified intactline-length = 120fromstyle_guides/python/pyproject.toml(flake8 not run — not installed in my active env)client.shipments./client.smartrate.occurrences remain underofficial/docs/python/