diff --git a/residential/samples/puppeteer.mdx b/residential/samples/puppeteer.mdx index b3b1cfd..2f0436c 100644 --- a/residential/samples/puppeteer.mdx +++ b/residential/samples/puppeteer.mdx @@ -14,11 +14,11 @@ const puppeteer = require('puppeteer'); const page = (await browser.pages())[0]; await page.authenticate({ - username: '{PROXY_USERNAME}, + username: '{PROXY_USERNAME}', password: '{API_KEY}' }); await page.goto('https://cloudflare.com/cdn-cgi/trace'); // Insert your target URL here console.log(await page.content()); browser.close(); })(); -``` \ No newline at end of file +``` diff --git a/residential/samples/python.mdx b/residential/samples/python.mdx index 772665c..bd63092 100644 --- a/residential/samples/python.mdx +++ b/residential/samples/python.mdx @@ -3,7 +3,7 @@ title: '(Vanilla) Python' description: 'To connect to the Massive Network from Python, include your encoded credentials in the proxy address (this usage doesn’t risk leaking your API token to a shared history file per the caveat for Curl):' --- -```javascript +```python #!/usr/bin/env python3 import requests import urllib @@ -17,4 +17,4 @@ proxy = f'https://{username}:{password}@{host}:{port}' response = requests.get(url, proxies={'http': proxy, 'https': proxy}) print(response.content) -``` \ No newline at end of file +``` diff --git a/residential/samples/ruby.mdx b/residential/samples/ruby.mdx index cec395c..ee0b654 100644 --- a/residential/samples/ruby.mdx +++ b/residential/samples/ruby.mdx @@ -3,22 +3,21 @@ title: 'Ruby' description: 'Ruby’s standard HTTP library doesn’t seem to support HTTPS proxy connections, so connect to the [Massive Network’s HTTP port](/authentication#http) with Ruby:' --- -```javascript -#!/usr/bin/env node -const puppeteer = require('puppeteer'); +```ruby +#!/usr/bin/env ruby +require 'net/http' +require 'uri' -(async () => { - const browser = await puppeteer.launch({ - args: ['--proxy-server=https://network.joinmassive.com:65535'] - }); - const page = (await browser.pages())[0]; +username = '{PROXY_USERNAME}' +password = '{API_KEY}' +url = URI('https://cloudflare.com/cdn-cgi/trace') # Insert your target URL here +host = 'network.joinmassive.com' +port = 65534 - await page.authenticate({ - username: '{PROXY_USERNAME}, - password: '{API_KEY}' - }); - await page.goto('https://cloudflare.com/cdn-cgi/trace'); // Insert your target URL here - console.log(await page.content()); - browser.close(); -})(); -``` \ No newline at end of file +proxy = Net::HTTP.Proxy(host, port, username, password) +response = proxy.start(url.host, url.port, use_ssl: url.scheme == 'https') do |http| + http.request(Net::HTTP::Get.new(url)) + end + +puts response.body +```