fix: provide user-agent during initial bulk data fetch#39
Open
psychedelicious wants to merge 1 commit into
Open
fix: provide user-agent during initial bulk data fetch#39psychedelicious wants to merge 1 commit into
psychedelicious wants to merge 1 commit into
Conversation
It appears Scryfall has recently changed their API and now requires `User-Agent` to be provided when fetching the bulk data listing at https://api.scryfall.com/bulk-data. When omitted, the request returns an object like this: ```json { "object": "error", "status": 400, "code": "bad_request", "subcode": "generic_user_agent", "details": "Your User-Agent string is currently a default value supplied by your HTTP library. Please provide a custom User-Agent that identifies your application when accessing the Scryfall API. If you are the developer of an application receiving this message, please contact the Scryfall team for assistance." } ``` Simple fix - extract the headers mtg-proxies used in `download()` to util function, and also use it in `depaginate()`.
1e0aa6f to
66786d4
Compare
Contributor
|
Confirming this is necessary. The earlier fix in cbe1b36 only patched |
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.
It appears Scryfall has recently changed their API and now requires
User-Agentto be provided when fetching the bulk data listing at https://api.scryfall.com/bulk-data.When omitted, the request returns an object like this:
{ "object": "error", "status": 400, "code": "bad_request", "subcode": "generic_user_agent", "details": "Your User-Agent string is currently a default value supplied by your HTTP library. Please provide a custom User-Agent that identifies your application when accessing the Scryfall API. If you are the developer of an application receiving this message, please contact the Scryfall team for assistance." }Simple fix - extract the headers mtg-proxies used in
download()to util function, and also use it indepaginate().