Git Product home page Git Product logo

Comments (8)

cosmicsplendor avatar cosmicsplendor commented on June 15, 2024 1

Mine is v0.7.1 too. I tried hard, but could not make it work. Normal proxies work fine, but when I try authentication, it always fails.

from hrequests.

HOSEENJ avatar HOSEENJ commented on June 15, 2024 1

to use proxy in sessions you can do like this:
session = hrequests.Session()
session.proxy = 'http://username:password@host:port'

from hrequests.

cosmicsplendor avatar cosmicsplendor commented on June 15, 2024

This library supports normal http proxies (example: http://proxy.example.com:8080).

But I couldn't get it to work with proxies that require username password authentication (example: http://username:[email protected]:8080).

I'd appreciate if you could me know whether and how this could be achieved.

from hrequests.

Cosmicoppai avatar Cosmicoppai commented on June 15, 2024

@cosmicsplendor hey, are able to find any workaround with this lib?

from hrequests.

ilyazub avatar ilyazub commented on June 15, 2024

Related to bogdanfinn/tls-client#66.

from hrequests.

cosmicsplendor avatar cosmicsplendor commented on June 15, 2024

@cosmicsplendor hey, are able to find any workaround with this lib?

I haven't been able to get this to work yet. Will update here if I find a workaround.

from hrequests.

cosmicsplendor avatar cosmicsplendor commented on June 15, 2024

this works, but you have to rely on requests library to create session:

import requests
import hrequests

proxies = {
'http': 'http://USERNAME:[email protected]',
'https': 'http://USERNAME:[email protected]'
}

session = requests.Session()
session.proxies.update(proxies)

response = hrequests.get('http://httpbin.org/ip', session=session)
print(response.text)

from hrequests.

ilyazub avatar ilyazub commented on June 15, 2024

@cosmicsplendor What hrequests version do you use? It worked for me with v0.7.1.

>>> import hrequests
>>> response = hrequests.get('http://httpbin.org/ip', debug=True, verify=False, proxies=proxies)
raw request bytes sent over wire: 344 (0 kb)
headers on request:
map[Accept:[*/*] Accept-Encoding:[gzip, deflate, br] Accept-Language:[en-US;q=0.5,en;q=0.3] Connection:[keep-alive] Header-Order::[] Host:[httpbin.org] Referer:[https://google.com] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.0 Safari/537.36]]
cookies on request:
[]
headers on response:
map[Access-Control-Allow-Credentials:[true] Access-Control-Allow-Origin:[*] Connection:[keep-alive] Content-Length:[31] Content-Type:[application/json] Date:[Wed, 10 Jan 2024 10:41:27 GMT] Server:[gunicorn/19.9.0]]
cookies on response:
[]
requested http://httpbin.org/ip : status 200
response body payload: {
  "origin": "...omitted..."
}

raw response bytes received over wire: 260 (0 kb)
>>> hrequests.__version__
'0.7.1'

from hrequests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.