How to configure proxies in instapy

Viewed 1134

I have a fully working instagram bot which is made using instapy and it was working fine, I wanted to add a proxy to instagram so I added this code

session = InstaPy(username=insta_username,
password=insta_password,proxy_username='',proxy_password='',
                  proxy_address='8.8.8.8', 
          proxy_port=8080,
headless_browser=False)


with smart_run(session):
    #code here

I am using a premium proxy so that is not a problem for sure, I have read from the documentation to add this block of code, but I am gettig this error now

Custom workspace set: "C://Users//Nikhil//Downloads//forthemodernhouses//forthemodernhouses/InstaPy" :]
to be targetted 
  
 already dmmed
  ['livs.cosy.home2019', 'aceservices2021', 'inmovidal', 'gsmwindowsltd', 'braithwaite_gateway', 'fangting_properties']
final to be dmmed 
InstaPy Version: 0.6.13
 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
Workspace in use: "C://Users//Nikhil//Downloads//forthemodernhouses//forthemodernhouses/InstaPy"
WARNING [2021-05-23 12:39:53] [forthemodernhouses]  Proxy Authentication is not working anymore due to the Selenium bug report: https://github.com/SeleniumHQ/selenium/issues/7239
WARNING [2021-05-23 12:39:55] [forthemodernhouses]  Unable to proxy authenticate
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2021-05-23 12:39:55] [forthemodernhouses]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo

the proxy requires a authentication, so ive added proxy username and password , but as the error says selenioum does not support it, So is there any other way I can add the proxy(not manually), then how

2 Answers

To avoid entering proxy-credentials manually you may try the following 2 options:

  1. Create a browser extension as mentioned here and call it before your InstaPy session

  2. Use the url authentication with selenium before you start your InstaPy session: source

    from selenium import webdriver  
    driver = webdriver.Firefox()  
    driver.get("https://username:password@host:port")  

I had the same problem. I've tried to change browser.py to use seleniumwire instead of selenium and it has worked great for me.

Related