Dmitrii-I / sportmonks

sportmonks is a Python 3.5+ package that implements SportMonks API.
MIT License
36 stars 11 forks source link

Request path encoding error on Windows OS #8

Closed kuscuogluo closed 4 years ago

kuscuogluo commented 4 years ago

Initializer function throws a 404 error and when compared with a Mac OS machine, the only difference in the request path. Hence, the library does not work at all.

On Windows: '/api/v2.0%5Ccontinents?api_token=&tz=Europe%2FIstanbul' On Mac: '/api/v2.0/continents?api_token=&tz=Europe%2FIstanbul'

burakuyar commented 4 years ago

The reason look like the os.path library, which uses the OS's seperator character for path joins.

https://stackoverflow.com/questions/50585275/can-i-join-urls-using-os-path-join-in-python-or-is-there-a-better-way

burakuyar commented 4 years ago

Using "/".join() instead of os.path.join will probably solve the problem.

Dmitrii-I commented 4 years ago

My bad, this seems like a bug. Will try to fix ASAP and release.

Dmitrii-I commented 4 years ago

To solve this properly I need to first reproduce the bug. I am pretty sure if I run unit tests in Windows, the bug will appear. Problem is that the unit tests do not run on Windows as part of CI but only on Linux.

I will first migrate the CI from Travis (Linux only) to GitHub Actions (Linux, Windows, and macOS).

Once we're on GitHub Actions, the bug should cause the CI to fail on Windows runner. I will then fix the bug and publish to PyPI.

Dmitrii-I commented 4 years ago

The bug has been fixed in version 1.1.1 which is now on PyPI: https://pypi.org/project/sportmonks/1.1.1/

It took a bit longer because I wanted to setup GitHub Actions tests on Windows. This is done and now the tests will run on Ubuntu and Windows on every push.