Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
EM-Twitter is an EventMachine-based ruby client for the Twitter Streaming API.
require 'em-twitter'
options = {
:path => '/1/statuses/filter.json',
:params => { :track => 'yankees' },
:oauth => {
:consumer_key => ENV['CONSUMER_KEY'],
:consumer_secret => ENV['CONSUMER_SECRET'],
:token => ENV['OAUTH_TOKEN'],
:token_secret => ENV['OAUTH_TOKEN_SECRET']
}
}
EM.run do
client = EM::Twitter::Client.connect(options)
client.each do |result|
puts result
end
end
SSL is used by default (EventMachine defaults to verify_peer => false), and can be configured:
options = {
:ssl => {
:private_key_file => "path/to/key.pem",
:cert_chain_file => "path/to/cert.pem",
:verify_peer => true
}
}
client = EM::Twitter.Client.connect(options)
EM-Twitter includes proxy support via a configuration option:
options = {
:proxy => {
:username => 'myusername',
:passowrd => 'mypassword',
:uri => 'http://my-proxy:8080'
}
}
client = EM::Twitter.Client.connect(options)
EM-Twitter supports the following callbacks for handling errors:
Errors callbacks are invoked on a Client like so:
client = EM::Twitter.Client.connect(options)
client.on_forbidden do
puts 'oops'
end
EM-Twitter has two callbacks for reconnection handling:
client = EM::Twitter.Client.connect(options)
client.on_reconnect do |timeout, count|
# called each time the client reconnects
end
client.on_max_reconnects do |timeout, count|
# called when the client has exceeded either:
# 1. the maximum number of reconnect attempts
# 2. the maximum timeout limit for reconnections
end
We recommend using TweetStream for a higher abstraction level interface.
To access the Twitter REST API, we recommend the Twitter gem.
EM-Twitter is heavily inspired by Vladimir Kolesnikov's twitter-stream. I learned an incredible amount from studying his code and much of the reconnection handling in EM-Twitter is derived/borrowed from his code as are numerous other bits. Eloy Durán's ssalleyware was very helpful in adding SSL Certificate verification as was David Graham's vines.
Testing with EM can be a challenge, but was made incredibly easy through the use of Hayes Davis' awesome mockingbird gem.
Copyright (c) 2011-2013 Steve Agalloco. See LICENSE for details.
FAQs
Unknown package
We found that em-twitter 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.