Skip to content

Commit

Permalink
Add carrier services metadata property for testing
Browse files Browse the repository at this point in the history
Introduced a new property `carrier_services_metadata` for retrieving carrier service information. This utility function makes a GET request to the carrier-services API and converts the response to a dictionary format for easier testing and validation.

related: karrioapi#675
  • Loading branch information
jacobshilitz committed Sep 11, 2024
1 parent af09400 commit dedfaaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/connectors/eshipper/karrio/providers/eshipper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ def access_token(self):

return new_auth["token"]

# for testing only
@property
def carrier_services_metadata(self):
result = lib.request(
url=f"{self.server_url}/api/carrier-services",
method="GET",
headers={
"content-Type": "application/json",
"Authorization": f"Bearer {self.access_token}",
},
)
response = lib.to_dict(result)
return {**response}


def login(settings: Settings):
"""Sign in response
Expand Down

0 comments on commit dedfaaf

Please sign in to comment.