Skip to content

Commit f719457

Browse files
authored
Merge pull request #374 from EasyPost/SHPE-594_sessions
feat: portal and embeddable sessions
2 parents 21965d9 + d2e683f commit f719457

12 files changed

+400
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## Next Release
4+
5+
- Adds the following functions:
6+
- `embeddable.create_session`
7+
- `customer_portal.create_account_link`
8+
39
## v10.2.0 (2025-11-10)
410

511
- Adds `UspsShipAccount` support to the create carrier method

easypost/easypost_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
CarrierAccountService,
2020
CarrierMetadataService,
2121
ClaimService,
22+
CustomerPortalService,
2223
CustomsInfoService,
2324
CustomsItemService,
25+
EmbeddableService,
2426
EndShipperService,
2527
EventService,
2628
InsuranceService,
@@ -65,8 +67,10 @@ def __init__(
6567
self.carrier_account = CarrierAccountService(self)
6668
self.carrier_metadata = CarrierMetadataService(self)
6769
self.claim = ClaimService(self)
70+
self.customer_portal = CustomerPortalService(self)
6871
self.customs_info = CustomsInfoService(self)
6972
self.customs_item = CustomsItemService(self)
73+
self.embeddable = EmbeddableService(self)
7074
self.end_shipper = EndShipperService(self)
7175
self.event = EventService(self)
7276
self.insurance = InsuranceService(self)

easypost/services/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
from easypost.services.carrier_account_service import CarrierAccountService
99
from easypost.services.carrier_metadata_service import CarrierMetadataService
1010
from easypost.services.claim_service import ClaimService
11+
from easypost.services.customer_portal_service import CustomerPortalService
1112
from easypost.services.customs_info_service import CustomsInfoService
1213
from easypost.services.customs_item_service import CustomsItemService
14+
from easypost.services.embeddable_service import EmbeddableService
1315
from easypost.services.end_shipper_service import EndShipperService
1416
from easypost.services.event_service import EventService
1517
from easypost.services.insurance_service import InsuranceService
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing import Any
2+
3+
from easypost.easypost_object import convert_to_easypost_object
4+
from easypost.requestor import (
5+
RequestMethod,
6+
Requestor,
7+
)
8+
from easypost.services.base_service import BaseService
9+
10+
11+
class CustomerPortalService(BaseService):
12+
def __init__(self, client):
13+
self._client = client
14+
15+
def create_account_link(self, **params) -> dict[str, Any]:
16+
"""Create a Portal Session."""
17+
response = Requestor(self._client).request(
18+
method=RequestMethod.POST,
19+
url="/customer_portal/account_link",
20+
params=params,
21+
)
22+
23+
return convert_to_easypost_object(response=response)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing import Any
2+
3+
from easypost.easypost_object import convert_to_easypost_object
4+
from easypost.requestor import (
5+
RequestMethod,
6+
Requestor,
7+
)
8+
from easypost.services.base_service import BaseService
9+
10+
11+
class EmbeddableService(BaseService):
12+
def __init__(self, client):
13+
self._client = client
14+
15+
def create_session(self, **params) -> dict[str, Any]:
16+
"""Create an Embeddables Session."""
17+
response = Requestor(self._client).request(
18+
method=RequestMethod.POST,
19+
url="/embeddables/session",
20+
params=params,
21+
)
22+
23+
return convert_to_easypost_object(response=response)

tests/cassettes/test_customer_portal_account_link_create.yaml

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/cassettes/test_embeddable_session_create.yaml

Lines changed: 143 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)