-
Notifications
You must be signed in to change notification settings - Fork 154
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
request_to method throws argument error for Ruby 3.0 #58
Comments
Perhaps using a double splat operator to restructure the hash that request_to passes into the handler, which should typically accept keyword arguments based on the conventions in the readme file: current:
with splats:
The reason this is currently failing is because the 'parse' method as currently method has a required 'url' keyword argument. Using the 'request_to' method, the 'url' parameter is included in the 'request_data' hash which is sent to the parse method. Under Ruby 3, the last positional hash argument is no longer converted to keyword arguments, so the parse method throws an error as it's not receiving the required url keyword argument. To fix this under ruby 3, using the double splat to convert the hash into keyword arguments passed to parse will fix it. |
i keep getitng error of this kind on many kimurai's methods |
@MarcoNaik thanks for the comment. I may create a pull request for this. Could you include some examples of which methods are throwing these errors? |
Just copying the example on the github I've had the same 'number of arguments method' with the 'save_to' method. and cant get attributes values with
sorry idk how to post log kinda new to this github forum thing |
Any progress on this? I am currently running into the same error |
I'm running into the same issue. |
I ran into the same issue as well. Worked around it by running my script on Ruby 2.7.5 instead of Ruby 3. |
Likewise I'm getting the error === Full error ===
|
I'm facing the same problem as well |
Hello,
First, think you for maintaining this fantastic framework.
I set up a spider pretty much identically to the one in the README. I wrote a parse function with the same arguments as those specified in the README as well (response, url:, data: {})
In my first parse function I used the respond_to method to route urls to a second parse function, which had the same arguments as the first.
I got the following error: wrong number of arguments (given 2, expected 1; required keyword: url) (ArgumentError)
I'm running Ruby 3.0.1.
I believe there may be an issue with the use of keyword arguments in the request_to method related to Ruby 3.0. The spider works fine when I visit the url using the browser object and call the second parse function directly.
This appears to be similar to the related issue with rbcat
I'm relatively new to Ruby, so I apologize in advance for any inaccuracies!
The text was updated successfully, but these errors were encountered: