2

So i have a call to an api, Looks like this (url removed for safety yada yada)

apicall = HTTParty.get(URI.encode('URL HERE'), headers: {"Authorization" => "Bearer apikey"}).parsed_response

Now what i'm wanting is to use my proxy ip address to access the web page. Would you be willing to point me in the right direction to do this?

I've aware how to do this in open-uri but not sure if its possibe to do a get request with a this gem.

Thanks Sam

1 Answer 1

2

This should work.

apicall = HTTParty.get(
  'URL HERE',
  http_proxyaddr:'PROXY IP HERE',
  http_proxyport: 'PROXY PORT HERE',
  http_proxyuser: 'PROXY USERNAME HERE',
  http_proxypass: 'PROXY PASSWORD HERE',
  headers: {"Authorization" => "Bearer apikey"}
).parsed_response

Skip the http_proxy**** keys that you don't have values for. Everything you need to better understand what you can implement in HTTParty can be found here: HTTParty Github

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.