Giter Club home page Giter Club logo

Comments (6)

sarartur avatar sarartur commented on May 29, 2024

Everything seems to work when I run the tests on my Windows machine. Could you please post the traceback in here?

from chess.com.

sabuhikhalili avatar sabuhikhalili commented on May 29, 2024

`Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1448, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Sabuhi Khalili/PycharmProjects/chesscom/main.py", line 10, in
player = ch.get_player_profile(USERNAME)
File "C:\Users\Sabuhi Khalili.conda\envs\temp\lib\site-packages\chessdotcom\client.py", line 39, in get_player_profile
r = Client.do_get_request(path = f"/player/{username}")
File "C:\Users\Sabuhi Khalili.conda\envs\temp\lib\site-packages\chessdotcom\client.py", line 30, in do_get_request
raise ChessDotComError(status_code=r.status)
chessdotcom.errors.ChessDotComError: [MESSAGE] -- Response not 200.[STATUS CODE] -- 403 [REFERENCE] -- https://www.chess.com/news/view/published-data-api
python-BaseException

Process finished with exit code 1
`

I also send screenshot of response at debugger

image

I am using Python 3.7

from chess.com.

sarartur avatar sarartur commented on May 29, 2024

The server is responding with 403. For some reason you are not allowed to access that resource. Look at this https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403. This might be specific to your IP.

The chessdotcomerror is returned only if the response code is not 200. The code is working as expected.

I do agree that the errors need to be reworked however since the server also returns more useful information on the error. I will roll out an update tonight.

from chess.com.

sabuhikhalili avatar sabuhikhalili commented on May 29, 2024

Thanks. I also think it might be related to ip as I am using some 'public' network, however this problem only emerges on urllib. Using requests or chrome to get response do not return the same error. I will use requests method in my code as a workaround, just wanted to let you know anyway. Good luck with your work

from chess.com.

sarartur avatar sarartur commented on May 29, 2024

Yes, I was actually thinking of switching to requests as well. Probably will add that in tonight with proxy support as well.

Thanks for letting me know!

from chess.com.

sarartur avatar sarartur commented on May 29, 2024

I updated the package to use requests package and improved the ChessDotComError object.

from chess.com.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.