Search code examples
pythonlinuxubuntucurleve

Python Eve - Datetime filtering not working on Ubuntu 20.04


I am using EVE 1.1.1, python 3.8 and curl 7.68.0

I have a curl GET request which works fine on Windows 10 but when I try to run it on Ubuntu Linux 20.04 I get an HTTP 400 BAD REQUEST error.

I have changed the DATE_FORMAT setting to "%d/%m/%y" in the settings.py file.

Nevertheless, when I remove the datetime filter it works fine on Linux as well.

My curl GET request is the following:

curl -g -H "Authorization: my_auth_token" -i "localhost:1010/my_data?where={%22date%22:%20{%22$eq%22:%2224/06/2020%22}}&pretty"

Solution

  • SOLVED

    It seems that Ubuntu was interpreting $eq in the filtering string as an environmental variable due to the $ character.

    In order to be able to execute the GET request I encoded the the $ character to urlencoded format which is %24.

    Therefore, my curl GET request has the following format:

    curl -g -H "Authorization: my_auth_token" -i "localhost:1010/my_data?where={%22date%22:%20{%22%24eq%22:%2224/06/2020%22}}&pretty"