Draft
Update Packt integration for current Packtpub API/login/claim flows#213
Conversation
Copilot created this pull request from a session on behalf of
luk6xff
June 7, 2026 01:28
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the Packt integration to match Packt’s current web/API authentication, free-learning claim flow, owned-entitlements retrieval, and download URL patterns so the CLI can claim and download content again.
Changes:
- Migrates authentication/session handling to Packt’s current
/api/loginflow usingcurl-cffifor browser impersonation. - Updates free-learning claiming to parse
offerId/metaProductIdfrom the/free-learningpage and claim via the new endpoint. - Updates owned library pagination and download URL construction (including file-type mapping), plus bumps package version/deps and README URL.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Bumps package version/url and adds curl-cffi dependency required for the new session behavior. |
| README.md | Updates the documented Free Learning URL to the current Packt path. |
| packt/api.py | Switches to cookie/session-based auth via curl_cffi.requests and adds per-request timeouts. |
| packt/claimer.py | Reworks owned-products pagination and updates free-learning offer discovery + claim call. |
| packt/downloader.py | Adds file-type mapping and updates download URL building and fetch logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
luk6xff
approved these changes
Jun 10, 2026
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.
Packt’s legacy
services.packtpub.comauth/claim flow no longer matches current Packt behavior, causing free-learning claim and owned-download workflows to fail. This change aligns authentication, offer discovery, entitlement retrieval, and download URL construction with current Packt endpoints/page structure.API/client migration
POST /api/loginGET /api/entitlements/users/me/ownedPOST /api/claim-free-learning/offers/{offer_id}Free-learning claim path update
offerIdandmetaProductIdfrom/free-learningpage source.Owned library + pagination hardening
Download flow compatibility
pdf -> ebook,code -> code_bundle,video -> video_zip).Packaging/docs updates
curl-cffi==0.15.0dependency for browser-like session behavior.