![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Pioneer is a simple async HTTP crawler based on em-synchrony
And it is very alpha right now.
gem install pioneer
To use Pioneer
you should specify a class with two methods: locations
and processing(req)
.
First one should return enumerable object and second will accept request object.
class Crawler << Pioneer::Base
def locations
["http://www.amazon.com", "http://www.apple.com"]
end
def processing(req)
File.open(req.url, "w+") do |f|
f << req.response.response
end
end
end
Crawler.new.start
In this example we are saving two files with html of those two sites.
start
method will start iterating over urls and return an Array of what processing
method returns.
In case of request or response error Pioneer
will raise an error. Or we can catch them this way:
class Crawler << Pioneer::Base
def locations
["http://www.amazon.com", "http://www.apple.com"]
end
def processing(req)
File.open(req.url, "w+") do |f|
f << req.response.response
end
end
def if_request_error(req)
puts "Request error: #{req.error}"
end
def if_response_error(req)
puts "Response error: #{req.response.error}"
end
def if_status_203(req)
puts "He is trying to redirect me"
end
end
also you can write if_status_not_200
to handle all statuses not 200, or if_status_XXX
for any status you want.
You can override all methods on the fly:
crawler = Pioneer::Crawler.new # base simple crawler
crawler.locations = [url1, url2]
crawler.processing = proc{ req.response.response_header.status }
crawler.if_status_404{ |req| "Oups" }
... to be continued
FAQs
Unknown package
We found that pioneer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.