wc-api-ruby icon indicating copy to clipboard operation
wc-api-ruby copied to clipboard

How could I use proxy to call an APIs

Open babarajay opened this issue 1 year ago • 2 comments

Description: I have a condition where I wanted to use proxy to call woo commerce APIs. I went thru the open/closed issues but I could not get anything related to it so raising a new one.

Any help would be appreciated.

Thank you.

babarajay avatar Feb 12 '24 12:02 babarajay

If @babarajay or anyone else is looking for how to do this, you can pass in httparty_args as an option:

woocommerce = WooCommerce::API.new(
  "http://example.com",
  "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  {
    wp_api: true,
    version: "wc/v3",
    httparty_args: {
      http_proxyaddr: "yourproxydomain.com",
      http_proxyport: 80, # or whatever your proxy port is
      http_proxyuser: "username",
      http_proxypass: "password"
    }
  }
)

raoulalwani avatar Aug 14 '24 20:08 raoulalwani

@raoulalwani thanks buddy!

babarajay avatar Aug 15 '24 01:08 babarajay