Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 500 Error on Every Card Method #39

Open
jacobmillsfl opened this issue Mar 24, 2023 · 4 comments
Open

HTTP 500 Error on Every Card Method #39

jacobmillsfl opened this issue Mar 24, 2023 · 4 comments

Comments

@jacobmillsfl
Copy link

Whatever backend server this SDK is calling is returning HTTP 500 errors. Even the simple examples in the README fail.
Example:

from mtgsdk import Card
card = Card.find(386616)

throws:

  File "/home/user/env/lib/python3.8/site-packages/mtgsdk/restclient.py", line 35, in get
    response = json.loads(urlopen(req).read().decode("utf-8"))
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

This SDK is unusable if its dependencies are unreliable.

@jacobmillsfl
Copy link
Author

jacobmillsfl commented Mar 24, 2023

The issue is with the API https://api.magicthegathering.io/v1

It's down. Any idea who manages it or if there is an alternative?

UPDATE: Actually the API is fine, the base URI just doesn't return anything by itself. That means something is wrong with the SDK. I'll continue to investigate.

@jacobmillsfl
Copy link
Author

And the issue is with the API after all. The MTG SDK attempts to "load all" by iterating each page. The API is throwing errors when giving a page other than 1. Example: This throws an error on the API.

https://api.magicthegathering.io/v1/cards?name=nissa&page=2

I could care less about paging in my app though. A single page of matches is more than enough. It would be nice if the caller was provided with a way to set fetch_all = False.

@jacobmillsfl
Copy link
Author

It looks like the API is throwing errors intermittently even for non-paging queries.

@jacobmillsfl
Copy link
Author

I switched to the Scryfall API and wrote my own SDK.

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

No branches or pull requests

1 participant