Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session and real_http cannot be used at the same time #145

Closed
dongfangtianyu opened this issue Sep 12, 2020 · 0 comments
Closed

session and real_http cannot be used at the same time #145

dongfangtianyu opened this issue Sep 12, 2020 · 0 comments

Comments

@dongfangtianyu
Copy link
Contributor

with Mocker(real_http=True) as mocker:
    mocker.get("https://www.google.com", status_code=200, text="Google")
    resp = requests.get("https://www.google.com")
    resp = requests.get("https://www.facebook.com")  # <-----  it's OK

s =  requests.Session()
with Mocker(session=s, real_http=True) as mocker:
    mocker.get("https://www.google.com", status_code=200, text="Google")
    resp = s.get("https://www.google.com")
    resp = s.get("https://www.facebook.com")  # <-----  TypeError: get_adapter() got multiple values for argument 'url'

Expected results:
session's' can get mock results by accessing registered addresses, and get real results by accessing unregistered addresses

Preliminary judgment:
when call get_ adapter, has one more parameter, like get_ adapter(self,self,url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant