mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Re-add option 2 example of interposition
This commit is contained in:
parent
705d396dff
commit
9887bb976d
1 changed files with 12 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ target requests are made transparently by the low level *tuf/client/updater.py*
|
|||
module.
|
||||
|
||||
|
||||
### Interposition Example
|
||||
### Interposition Examples
|
||||
|
||||
To use interposition, integrators must:
|
||||
|
||||
|
|
@ -26,6 +26,8 @@ To use interposition, integrators must:
|
|||
4. Deconfigure interposition.
|
||||
|
||||
|
||||
## Option 1
|
||||
|
||||
```python
|
||||
from tuf.interposition import urllib_tuf as urllib
|
||||
from tuf.interposition import urllib2_tuf as urllib2
|
||||
|
|
@ -48,6 +50,15 @@ tuf.interposition.deconfigure(configuration)
|
|||
|
||||
```
|
||||
|
||||
## Option 2
|
||||
|
||||
```python
|
||||
@tuf.interposition.open_url
|
||||
def instancemethod(self, url, ...):
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
Note: tuf.interposition.refresh(configuration) may be called to force a
|
||||
refresh of the TUF metadata. Interposition normally performs a refresh of TUF
|
||||
metadata when configure() is called.
|
||||
|
|
|
|||
Loading…
Reference in a new issue