Skip to content

fix: provide user-agent during initial bulk data fetch#39

Open
psychedelicious wants to merge 1 commit into
DiddiZ:mainfrom
psychedelicious:psychedelicious/fix/scryfall-headers
Open

fix: provide user-agent during initial bulk data fetch#39
psychedelicious wants to merge 1 commit into
DiddiZ:mainfrom
psychedelicious:psychedelicious/fix/scryfall-headers

Conversation

@psychedelicious

@psychedelicious psychedelicious commented Jun 7, 2026

Copy link
Copy Markdown

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:

{
  "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().

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()`.
@psychedelicious psychedelicious force-pushed the psychedelicious/fix/scryfall-headers branch from 1e0aa6f to 66786d4 Compare June 7, 2026 01:57
@spawnia

spawnia commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Confirming this is necessary. The earlier fix in cbe1b36 only patched download(), so depaginate() still hits the 400 generic_user_agent error - and it's used for both /bulk-data and /cards/search, so any code path going through Scryfall search breaks. Ran into this myself, the patch here fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants