Skip to main content

pipeline status coverage report

⚠️ WORK IN PROGRESS ⚠️

This library is a Python wrapper for accessing Seguimiento Correos JSON API.

Operations

  • The API will provide all the necessary data for tracking a shipment. With this module you can check if the parcel is already delivered or relabeled and get the new tracking code.

More info about the API in docs.

Installation

$ pip install correos-seguimiento

Usage

Check if shipment is delivered

>>> from correos_seguimiento.services.shipment import TrackingShipment
>>>
>>> shipment = TrackingShipment("XXX", "XXX", "PQXXX10721392610108021C").build()
>>> shipment.is_delivered()
False
>>> shipment.is_delivered()
True

Check if shipment is relabeled and get the new tracking code

>>> from correos_seguimiento.services.shipment import TrackingShipment
>>>
>>> shipment = TrackingShipment("XXX", "XXX", "PQXXX10721392610108021C").build()
>>> shipment.is_delivered()
False
>>> shipment.is_relabeled()
True
>>> shipment.get_relabeled_shipment_code()
"PY53VM9100000810108640T"

Check if shipment is returned

>>> from correos_seguimiento.services.shipment import TrackingShipment
>>>
>>> shipment = TrackingShipment("XXX", "XXX", "PQXXX10721392610108021C").build()
>>> shipment.is_returned()
False
>>> shipment.is_returned()
True

Development

Setup environment

  1. Install pyenv
curl https://pyenv.run | bash
  1. Build the Python version
pyenv install  3.7.13
  1. Create a virtualenv
pyenv virtualenv 3.7.13 correos-seguimiento
  1. Install dependencies
pyenv exec pip install -r requirements.txt
  1. Install pre-commit hooks
pyenv exec pre-commit install

Test the HTTP request

We are using the HTTP recording plugin of Pytest: pytest-recording.

With VRC we can catch the HTTP responses and then, execute the tests using them.

To add a new test:

  • Expose the needed envvars. Look for them at the Configuration Environment section
  • Execute the tests using pytest command:
  • If you are writing a new test that is making requests, you should run:
$ pytest --record-mode=once path/to/your/test
  • You might need to record requests for an specific tests. In that case make sure to only run the tests affected and run
$ pytest --record-mode=rewrite path/to/your/test
  • Add the new cassetes to the commit and push them.
  • The CI uses the cassetes to emulate the HTTP response in the test.

Run test suite

$ tox

Formatting

We use Black as formatter. First to commit, tun the black command:

$ black .
All done! ✨ 🍰 ✨
29 files left unchanged.

Darker

Black is a great formatter, but to mantain your code without execute the black command avery time, you can configure your IDE to use darker to format only the changed or added code when you save the file.

Release process

Update CHANGELOG.md following this steps:

  1. Add any entries missing from merged merge requests.
  2. Duplicate the [Unreleased] header.
  3. Replace the second Unreleased with a version number followed by the current date. Copy the exact format from previous releases.

Then, you can release and publish the package to PyPi:

  1. Update the VERSION var in setup.py matching the version you specified in the CHANGELOG.
  2. Open a merge request with these changes for the team to approve
  3. Merge it, add a git tag on that merge commit and push it.
  4. Once the pipeline has successfully passed, your package had been published.

Metadata

Release files for correos-seguimiento 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for correos-seguimiento 0.3.0
File Size Uploaded
correos-seguimiento-0.3.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for correos-seguimiento 0.3.0
File Interpreter ABI Platform
correos_seguimiento-0.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.0 kB

Release files / correos-seguimiento-0.3.0.tar.gz

Download URL correos-seguimiento-0.3.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ee763fbdd2efbc7be5e4c05505bd0abbda814b9f838d7688c5621a1c3e1f8894
BLAKE2b-256 checksum
How to use checksums
191c26c8a442096bcc54a26a33544bb01768b40218ce23a28e3c5593cc036394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Release files / correos_seguimiento-0.3.0-py2.py3-none-any.whl

Download URL correos_seguimiento-0.3.0-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a2dbf2a9b3869ed04dd882fbbb46cbe5b9dcb3042b069cef2291109e3f8ed260
BLAKE2b-256 checksum
How to use checksums
128fc982c0a88db31fb8ecab229cbfd5b58fd7eae844399eff554227c7f7d10e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

0.0.3

2 release files

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page