opencultureconsulting / openrefine-client

The OpenRefine Python Client from Paul Makepeace provides a library for communicating with an OpenRefine server. This fork extends the command line interface (CLI) and is distributed as a convenient one-file-executable (Windows, Linux, Mac). It is also available via Docker Hub, PyPI and Binder.
GNU General Public License v3.0
83 stars 19 forks source link

add CSRF token to API calls (introduced with OpenRefine 3.3) #7

Closed msaby closed 3 years ago

msaby commented 5 years ago

Hi I'm trying to use your client. I launched openrefine (3.3beta), downloaded openrefine-client it and launched the command (Win10, powershell) .\openrefine-client_0-3-8_windows.exe --create .\duplicates.csv

I got this error. I am missing a step ?

Traceback (most recent call last): File "refine.py", line 36, in File "google\refine__main__.py", line 251, in main File "google\refine\cli.py", line 127, in create File "google\refine\refine.py", line 281, in new_project Exception: Project not created [9952] Failed to execute script refine

felixlohmeier commented 5 years ago

Currently the openrefine-client only supports OpenRefine up to version 3.2.

OpenRefine 3.3 introduces CSRF tokens:

Cross-Site Request Forgery (CSRF) protection was added to POST API endpoints. If you rely on OpenRefine's server API you will need to adapt your calls accordingly (#2164) (https://github.com/OpenRefine/OpenRefine/releases/tag/3.3-beta)

I will update the client accordingly, probably next month.

jqnatividad commented 4 years ago

Hi @felixlohmeier, first off, thanks for this amazing automation. I'm checking to see when you plan to support OpenRefine 3.3.

I'm using openrefine batch quite successfully with https://github.com/dathere/covid19-time-series-utilities.

Though it works, it just shows a lot of console warnings.

felixlohmeier commented 4 years ago

Hi @jqnatividad, thanks a lot! I didn't make it back in December and I'm on parental leave now. I'm planning on it for the next quarter, so by the end of June.

felixlohmeier commented 4 years ago

I have done some experiments with cURL recently. Here is a bash script that supports batch processing with OpenRefine 3.3: https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d

Will update the openrefine-client by the end of July. Sorry for the delay.

felixlohmeier commented 3 years ago

release v0.3.10 now works with OpenRefine 3.3+