How do I make a requesocks request with socks5 username and password?

Encompass

I currently use this for my connection to a socks5 proxy and paramiko.

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,socks_hostname,socks_port, True, socks_username,socks_password)
paramiko.client.socket.socket = socks.socksocket
ssh = paramiko.SSHClient()

However, I was hoping to make some requests in python with requesocks and the same proxy settings for the paramiko and couldn't find anything talking about a username and password.

Additionally, all requests are done with a different socks connection each time, Global settings could get in the way of my other connections.

Any ideas on how this is done or if there is an alternative to this? My current implementation uses python requests very heavily so it would be nice to transition from there to requesocks so I don't have to refactor everything.

Note: How to make python Requests work via socks proxy doesn't work as it doesn't use the socks5 authentication.

ilovepython

You can use PySocks:

pip install PySocks

Then in your python file:

import socket
import socks
import requests

socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 9050, True, 'socks5_user','socks_pass')
socket.socket = socks.socksocket
print(requests.get('http://ifconfig.me/ip').text)

It works for me. But I got another problem to use different socks5 proxy for different request sessions. If anyone has solution for this, please kindly contribute.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

how can i make a username and password test method that doesnt overlap?

분류에서Dev

How do I ensure Git doesn't ask me for my GitHub username and password?

분류에서Dev

How can i change activity using login (username and password) ,button ?

분류에서Dev

How to bypass proxy with either VPN or Socks5

분류에서Dev

how do I save a ftp password but get the plain password later

분류에서Dev

How do I allow SFTP with a password BUT not SSH?

분류에서Dev

How do disable user list on login screen? (Prompt for username and password) Ubuntu 15.10

분류에서Dev

socks5 사용자 이름과 비밀번호로 requesocks 요청을하려면 어떻게해야합니까?

분류에서Dev

How to make username in terminal smaller?

분류에서Dev

How do I make variable in for loop bigger that in was

분류에서Dev

How do I make a "for" loop for this sequence of arrays?

분류에서Dev

How do I make a decorator typesafe in TypeScript?

분류에서Dev

How do I make a Range reverse on condition?

분류에서Dev

How do I make a border padding for a UITextField?

분류에서Dev

How do I make use of rotation matrices?

분류에서Dev

How do I make a table of indexes

분류에서Dev

How Do I Make A Rectangle in GEOS?

분류에서Dev

How do I make stdin a tty?

분류에서Dev

how do i make my code shorter

분류에서Dev

How do I make space on /boot?

분류에서Dev

How do I make a WebView transparent?

분류에서Dev

How do I make coffee with Ubuntu?

분류에서Dev

How do I turn off all the password prompts?

분류에서Dev

How do I prevent PolicyKit from asking for a password?

분류에서Dev

How do I password protect a .tgz file with tar in Unix?

분류에서Dev

How do I reset the password on a Dedicated Micros DVR?

분류에서Dev

How do I run a sudo command needing password input in the background?

분류에서Dev

How do I decrypt a password-protected PDF on OSX?

분류에서Dev

How to restrict access to socks5 server only through one hostname?

Related 관련 기사

  1. 1

    how can i make a username and password test method that doesnt overlap?

  2. 2

    How do I ensure Git doesn't ask me for my GitHub username and password?

  3. 3

    How can i change activity using login (username and password) ,button ?

  4. 4

    How to bypass proxy with either VPN or Socks5

  5. 5

    how do I save a ftp password but get the plain password later

  6. 6

    How do I allow SFTP with a password BUT not SSH?

  7. 7

    How do disable user list on login screen? (Prompt for username and password) Ubuntu 15.10

  8. 8

    socks5 사용자 이름과 비밀번호로 requesocks 요청을하려면 어떻게해야합니까?

  9. 9

    How to make username in terminal smaller?

  10. 10

    How do I make variable in for loop bigger that in was

  11. 11

    How do I make a "for" loop for this sequence of arrays?

  12. 12

    How do I make a decorator typesafe in TypeScript?

  13. 13

    How do I make a Range reverse on condition?

  14. 14

    How do I make a border padding for a UITextField?

  15. 15

    How do I make use of rotation matrices?

  16. 16

    How do I make a table of indexes

  17. 17

    How Do I Make A Rectangle in GEOS?

  18. 18

    How do I make stdin a tty?

  19. 19

    how do i make my code shorter

  20. 20

    How do I make space on /boot?

  21. 21

    How do I make a WebView transparent?

  22. 22

    How do I make coffee with Ubuntu?

  23. 23

    How do I turn off all the password prompts?

  24. 24

    How do I prevent PolicyKit from asking for a password?

  25. 25

    How do I password protect a .tgz file with tar in Unix?

  26. 26

    How do I reset the password on a Dedicated Micros DVR?

  27. 27

    How do I run a sudo command needing password input in the background?

  28. 28

    How do I decrypt a password-protected PDF on OSX?

  29. 29

    How to restrict access to socks5 server only through one hostname?

뜨겁다태그

보관