-
-
Save kivanio/2fa6f8073d18a2e0b905665a373e6b8e to your computer and use it in GitHub Desktop.
Request ssoid for accesing API-NG betfair.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/https" | |
require "uri" | |
crt = File.read("client-2048.crt") | |
key = File.read("client-2048.key") | |
app_key = "YOUR_APP_KEY" | |
username = "YOUR_USERNAME" | |
password = "YOUR_PASSWORD" | |
uri = URI.parse("https://identitysso.betfair.com/api/certlogin") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.cert = OpenSSL::X509::Certificate.new(crt) | |
http.key = OpenSSL::PKey::RSA.new(key) | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request["Content-Type"] = "application/x-www-form-urlencoded" | |
request["X-Application"] = app_key | |
request.set_form_data({"username" => username, "password" => password}) | |
response = http.request request | |
puts response.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment