-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
451 additions
and
162 deletions.
There are no files selected for viewing
This file contains 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 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 +1 @@ | ||
0.1.9 | ||
0.1.10 |
This file contains 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 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 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 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 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,55 @@ | ||
.. urllib2 | ||
urllib2 | ||
******** | ||
|
||
|
||
Import hoverpy's main class: HoverPy | ||
|
||
.. code:: python | ||
from hoverpy import HoverPy | ||
Create our HoverPy object in capture mode | ||
|
||
.. code:: python | ||
hp = HoverPy(capture=True) | ||
Import urllib2 for http | ||
|
||
.. code:: python | ||
import urllib2 | ||
Build our proxy handler for urllib2. This is currently a rather crude | ||
method of initialising urllib2, and this code will be incorporated into | ||
the main library shortly. | ||
|
||
.. code:: python | ||
proxy = urllib2.ProxyHandler({'http': 'localhost:8500'}) | ||
opener = urllib2.build_opener(proxy) | ||
urllib2.install_opener(opener) | ||
Print the json from our get request. Hoverpy acted as a proxy: it made | ||
the request on our behalf, captured it, and returned it to us. | ||
|
||
.. code:: python | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) | ||
Switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all | ||
it does from now on is replay the captured data. | ||
|
||
.. code:: python | ||
hp.simulate() | ||
Print the json from our get request. This time the data comes from the | ||
store. | ||
|
||
.. code:: python | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) | ||
This file contains 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,46 @@ | ||
.. urllib3 | ||
urllib3 | ||
******** | ||
|
||
|
||
Import hoverpy's main class: HoverPy | ||
|
||
.. code:: python | ||
from hoverpy import HoverPy | ||
Create our HoverPy object in capture mode | ||
|
||
.. code:: python | ||
hp = HoverPy(capture=True) | ||
Import urllib3 for http, and build a proxy manager | ||
|
||
.. code:: python | ||
import urllib3 | ||
http = urllib3.proxy_from_url("http://localhost:8500/") | ||
Print the json from our get request. Hoverpy acted as a proxy: it made | ||
the request on our behalf, captured it, and returned it to us. | ||
|
||
.. code:: python | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) | ||
Switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all | ||
it does from now on is replay the captured data. | ||
|
||
.. code:: python | ||
hp.simulate() | ||
Print the json from our get request. This time the data comes from the | ||
store. | ||
|
||
.. code:: python | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) | ||
This file contains 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 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 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 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 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 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,51 @@ | ||
Import hoverpy's main class: HoverPy | ||
|
||
```python | ||
from hoverpy import HoverPy | ||
|
||
``` | ||
|
||
Create our HoverPy object in capture mode | ||
|
||
```python | ||
hp = HoverPy(capture=True) | ||
|
||
``` | ||
|
||
Import urllib2 for http | ||
|
||
```python | ||
import urllib2 | ||
|
||
``` | ||
|
||
Build our proxy handler for urllib2. This is currently a rather crude method of initialising urllib2, and this code will be incorporated into the main library shortly. | ||
|
||
```python | ||
proxy = urllib2.ProxyHandler({'http': 'localhost:8500'}) | ||
opener = urllib2.build_opener(proxy) | ||
urllib2.install_opener(opener) | ||
|
||
``` | ||
|
||
Print the json from our get request. Hoverpy acted as a proxy: it made the request on our behalf, captured it, and returned it to us. | ||
|
||
```python | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) | ||
|
||
``` | ||
|
||
Switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all it does from now on is replay the captured data. | ||
|
||
```python | ||
hp.simulate() | ||
|
||
``` | ||
|
||
Print the json from our get request. This time the data comes from the store. | ||
|
||
```python | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) | ||
|
||
``` | ||
|
This file contains 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,26 @@ | ||
# import hoverpy's main class: HoverPy | ||
from hoverpy import HoverPy | ||
|
||
# create our HoverPy object in capture mode | ||
hp = HoverPy(capture=True) | ||
|
||
# import urllib2 for http | ||
import urllib2 | ||
|
||
# build our proxy handler for urllib2. This is currently a rather crude | ||
# method of initialising urllib2, and this code will be incorporated into | ||
# the main library shortly. | ||
proxy = urllib2.ProxyHandler({'http': 'localhost:8500'}) | ||
opener = urllib2.build_opener(proxy) | ||
urllib2.install_opener(opener) | ||
|
||
# print the json from our get request. Hoverpy acted as a proxy: it made | ||
# the request on our behalf, captured it, and returned it to us. | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) | ||
|
||
# switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all | ||
# it does from now on is replay the captured data. | ||
hp.simulate() | ||
|
||
# print the json from our get request. This time the data comes from the store. | ||
print(urllib2.urlopen("http://ip.jsontest.com/myip").read()) |
This file contains 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,43 @@ | ||
Import hoverpy's main class: HoverPy | ||
|
||
```python | ||
from hoverpy import HoverPy | ||
|
||
``` | ||
|
||
Create our HoverPy object in capture mode | ||
|
||
```python | ||
hp = HoverPy(capture=True) | ||
|
||
``` | ||
|
||
Import urllib3 for http, and build a proxy manager | ||
|
||
```python | ||
import urllib3 | ||
http = urllib3.proxy_from_url("http://localhost:8500/") | ||
|
||
``` | ||
|
||
Print the json from our get request. Hoverpy acted as a proxy: it made the request on our behalf, captured it, and returned it to us. | ||
|
||
```python | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) | ||
|
||
``` | ||
|
||
Switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all it does from now on is replay the captured data. | ||
|
||
```python | ||
hp.simulate() | ||
|
||
``` | ||
|
||
Print the json from our get request. This time the data comes from the store. | ||
|
||
```python | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) | ||
|
||
``` | ||
|
This file contains 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,20 @@ | ||
# import hoverpy's main class: HoverPy | ||
from hoverpy import HoverPy | ||
|
||
# create our HoverPy object in capture mode | ||
hp = HoverPy(capture=True) | ||
|
||
# import urllib3 for http, and build a proxy manager | ||
import urllib3 | ||
http = urllib3.proxy_from_url("http://localhost:8500/") | ||
|
||
# print the json from our get request. Hoverpy acted as a proxy: it made | ||
# the request on our behalf, captured it, and returned it to us. | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) | ||
|
||
# switch HoverPy to simulate mode. HoverPy no longer acts as a proxy; all | ||
# it does from now on is replay the captured data. | ||
hp.simulate() | ||
|
||
# print the json from our get request. This time the data comes from the store. | ||
print(http.request('GET', 'http://ip.jsontest.com/myip').data) |
Oops, something went wrong.