Comments (7)
Thanks! The new version seems to work well.
from python-mocket.
I'll have a look at it. Thanks for reporting the issue.
from python-mocket.
Perfect, I was asking to try it out just because I was not able to run the whole pipeline. I'll try to tackle all the other problems that appear and release a new version ASAP.
from python-mocket.
urllib3 never actually exported wrap_socket, it was imported from ssl, that is what mocket is pulling in. That import was removed for 2.0.
from python-mocket.
@oschwald could you please test out the code from the above PR?
Don't worry if tests are failing, they rely A LOT on httpbin.org and it's returning some BAD GATEWAY errors here and there. I have a plan to replace it with a Docker container, but it was not an easy change and I had no time to complete it.
from python-mocket.
Thanks for making the PR! Unfortunately, I am getting errors like this one with it when using urllib3
2.0.2:
======================================================================
ERROR: test_weird_body_error (tests.webservice_test.TestClient)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/mocket/mocket.py", line 701, in wrapper
return test(*args, **kwargs)
File "/home/greg/MaxMind/GeoIP2-python/tests/webservice_test.py", line 177, in test_weird_body_error
self.run_client(self.client.country("1.2.3.8"))
File "/home/greg/MaxMind/GeoIP2-python/geoip2/webservice.py", line 462, in country
Country, self._response_for("country", geoip2.models.Country, ip_address)
File "/home/greg/MaxMind/GeoIP2-python/geoip2/webservice.py", line 489, in _response_for
response = self._session.get(uri, proxies=self._proxies, timeout=self._timeout)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/connection.py", line 635, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/connection.py", line 728, in _ssl_wrap_socket_and_match_hostname
context = create_urllib3_context(
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 282, in create_urllib3_context
context.minimum_version = TLSVersion.TLSv1_2
File "/home/greg/.pyenv/versions/3.10.0/lib/python3.10/ssl.py", line 603, in minimum_version
super(SSLContext, SSLContext).minimum_version.__set__(self, value)
AttributeError: 'super' object has no attribute 'minimum_version'
urllib3
1.26.4 works fine with the changes in the PR.
from python-mocket.
Enjoy the new version of Mocket: https://pypi.org/project/mocket/3.11.1/
from python-mocket.
Related Issues (20)
- Cannot inject HTTPX client as pytest fixture HOT 9
- Support for `fastapi`.`TestClient` HOT 36
- [mocket-3.10.x] AttributeError: type object 'Mocket' has no attribute '_address' HOT 7
- Support for asyncpg HOT 2
- Server respond first upon client connect HOT 1
- Question / feature request: using truesocket recording mode for an in-process HTTP server HOT 9
- Question: function responses and regex HOT 5
- Add type hints to improve codebase readability and enable static type checking HOT 7
- Feature Request / Question - Mocking with proxies HOT 5
- Errors with aiohttp 3.8.6 HOT 5
- Documentation on direct socket mocking? HOT 4
- Async example fails on Python 3.11 when URL is changed to HTTPS HOT 6
- Enable pook for newer Python versions HOT 4
- Can't make a mixture of unmocked and mocked HTTPS requests using aiohttp HOT 1
- Can't make an HTTPS request with 'no verify' mode using aiohttp when Mocket is active HOT 1
- "Too many open files" error when making many mocked async requests HOT 1
- Feature request: allow specifying exceptions to strict mode HOT 2
- Establishing connections against multiple hosts can cause true socket connection to get created against the wrong host
- Issue using big response object in Entry with async client HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-mocket.