-
-
Notifications
You must be signed in to change notification settings - Fork 134
Requests support #32
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
Closed
Closed
Requests support #32
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
18a2d6c
Adding Support For Requests Library
63b0421
Cleaning Up New Tests
14cf9ad
Merge remote-tracking branch 'p1c2u/master' into RequestsSupport
650a57b
Fixing Pep8 Errors
6a4464e
Using Python 3.4,3.5 Compatible Syntax
1e5b141
Streamlining Test Response Comparisons
7697d30
Adding Better Error Handling and Code Coverage
7b396ea
Fixing Pep Errors
e28a29d
Fixing Bug Where Requests Request Doesn't Have a Property
1cfb857
Fixing Yarl Requirement
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
openapi-spec-validator | ||
six | ||
typing | ||
yarl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ pytest | |
pytest-pep8 | ||
pytest-flakes | ||
pytest-cov | ||
requests | ||
requests-mock | ||
flask |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from os import path | ||
|
||
import pytest | ||
from six.moves.urllib import request | ||
from yaml import safe_load | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
openapi: "3.0.0" | ||
info: | ||
title: Minimal valid OpenAPI specification with explicit 'servers' array | ||
version: "0.1" | ||
servers: | ||
- url: https://{customerId}.saas-app.com:{port}/v2 | ||
variables: | ||
customerId: | ||
default: demo | ||
description: Customer ID assigned by the service provider | ||
port: | ||
enum: | ||
- '443' | ||
- '8443' | ||
default: '443' | ||
paths: | ||
/status: | ||
get: | ||
responses: | ||
default: | ||
description: Return the API status. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should accept request object (not response).
http://docs.python-requests.org/en/master/api/#lower-level-classes
User don't need to have response to be able to validate request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the requests library explicitly uses a request object in its normal flow. Instead the response starts out as a function. You don't get an actual response object until after the http result is returned.
response = requests.post('http://httpbin.org/post', data = {'key':'value'}) request = response.request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I misread what you were getting at. I pass in the response because of the way that the requests library distributes its data. For example, in order to get cookies it needs the response object even though cookies are a part of the request model in your interface.
I also use it to extract the correct mimetype in case the request doesn't have an 'Accept' header.