Created
December 10, 2021 19:07
-
-
Save nil96/5a06ae46b51ff4060fdc12ea65912a02 to your computer and use it in GitHub Desktop.
This file contains 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 "uri" | |
require "json" | |
require "net/http" | |
url = URI("https://staging-runner.cargoes.com/services/Default/ServiceTypes/Create") | |
File.foreach('service.csv').with_index do |line, line_num| | |
https = Net::HTTP.new(url.host, url.port) | |
https.use_ssl = true | |
arr = line.split('$'); | |
request = Net::HTTP::Post.new(url) | |
request["authority"] = "staging-runner.cargoes.com" | |
request["sec-ch-ua"] = "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Google Chrome\";v=\"96\"" | |
request["accept"] = "application/json, text/javascript, */*; q=0.01" | |
request["content-type"] = "application/json" | |
request["x-requested-with"] = "XMLHttpRequest" | |
request["sec-ch-ua-mobile"] = "?0" | |
request["user-agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36" | |
request["sec-ch-ua-platform"] = "\"macOS\"" | |
request["origin"] = "https://staging-runner.cargoes.com" | |
request["sec-fetch-site"] = "same-origin" | |
request["sec-fetch-mode"] = "cors" | |
request["sec-fetch-dest"] = "empty" | |
request["referer"] = "https://staging-runner.cargoes.com/Default/ServiceTypes" | |
request["accept-language"] = "en-GB,en-US;q=0.9,en;q=0.8" | |
request["cookie"] = "_gcl_au=1.1.1266271950.1632407035; _ga=GA1.2.690476173.1632407039; gaconnector_GA_Client_ID=690476173.1632407039; _hjid=278a1159-0499-4c3f-a2f2-3fda1fbef722; _hjSessionUser_2326152=eyJpZCI6ImFlZTY1NGY1LWRlMTgtNTUxNS1iN2Q3LWE3Yzc5NzM5OTVkMyIsImNyZWF0ZWQiOjE2MzgxODUwNTI3NTcsImV4aXN0aW5nIjp0cnVlfQ==; gaconnector_gclid=; gaconnector_fc_source=(direct); gaconnector_lc_source=(direct); gaconnector_fc_medium=(none); gaconnector_lc_medium=(none); gaconnector_fc_campaign=(direct); gaconnector_lc_campaign=(direct); gaconnector_fc_term=(not set); gaconnector_lc_term=(not set); gaconnector_fc_content=(not set); gaconnector_lc_content=(not set); gaconnector_fc_landing=https://demo.cargoes.com/; gaconnector_lc_landing=https://demo.cargoes.com/; gaconnector_fc_referrer=(not set); gaconnector_lc_referrer=(not set); gaconnector_fc_channel=Direct; gaconnector_lc_channel=Direct; gaconnector_ip_address=-; gaconnector_OS=Mac OS 10.15.7; gaconnector_device=desktop; gaconnector_browser=Chrome 96.0.4664.55; gaconnector_city=Kolkata; gaconnector_country=India; gaconnector_country_code=IN; gaconnector_region=West Bengal; gaconnector_time_zone=Asia/Kolkata; gaconnector_latitude=22.518; gaconnector_longitude=88.3832; gaconnector_all_traffic_sources=(direct)/(none), (direct)/(none); gaconnector_pages_visited_list=/runner|/|/login|/logistics; gaconnector_page_visits=4; gaconnector_time_passed=120414263; .AspNetCore.Antiforgery.pUOXNTmQ6pM=CfDJ8MRqjtC4arRBhYRw_XNteLBEgFhzECwboSYLVIAEkHEzuydNYckgsvvQ1bHQoN6CudWJ8M4HAuiKI8Og4eCfhzw_J9B8X1OGRw9wcW9LYNHoF0g3zTSzd-6zyd8JZxMO4buDWqmT1CBAO3cJCqp-d7Q; sessionId=CfDJ8MRqjtC4arRBhYRw_XNteLB08uIzKXk9zTAgRhCgxq4vquu807A_D1VYnQrK56sCCbwl23aOBvn3jctqgbRFNxLvbfrxCLaS9OmcqhgE4ZRMHUOmWCBFkfOMcDztMKVAOlA8e1cpWVmMUlmer8mQ4Es_6AcJY_xSQRy8y8sxjJpvq911cWG4u8O7bkRj7B22RSC-oEKAhINI4lfbv_WkToke36mwyDCi12q_6sQjjkbH7f3qMyAZi1KYNIayRBdHLNcQYsHIsqtlwAJQ2-q140_FQn7o7NwdB24p5KAS2L28XAye7NxTPYMS2gdLAjHCWDNXaUXIYEhXmJTt-MXMJ1g; .AspNetAuth=CfDJ8MRqjtC4arRBhYRw_XNteLBMIt0TTvsUJv3kM7wZydikxG8TmV4YY-rL45Nv8K8Ytw3YEgfkdEeuIVy6i_Ebxkjc2ueW1fUxpd6E3QxxJoaSaBv1AU7sNFQOMNDmWJjULWKECSTKxnuKZoYA3Vry6OJF4kG2rP6SX3QcPmVFMIv68SCY86L8GEKZEljSHl_lVG2uk0XnFR2GcBEL0pfVZ63n9H8x34rDaX9HjdHeTGIh8250IOBeByIP8J6NcRExyhdWwd0iqV-XUg6OiOxmG5mGtTR9aCb72rt4b3Nu9MC4iskGBr3z6O_EyfYxhdsI-dg4uxOn5l2BleplPake7DQ" | |
request.body = JSON.dump({ | |
"Entity": { | |
"ServiceCode": arr[0].to_s, | |
"ServiceName": arr[1].to_s | |
} | |
}) | |
response = https.request(request) | |
puts response.read_body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment