| 1 |
Introduction |
| 2 |
------------ |
| 3 |
|
| 4 |
.. include:: ../README.rst |
| 5 |
|
| 6 |
|
| 7 |
Examples |
| 8 |
======== |
| 9 |
|
| 10 |
Background scheduling |
| 11 |
^^^^^^^^^^^^^^^^^^^^^ |
| 12 |
You can use Crochet to schedule events that will run in the background |
| 13 |
without slowing down the page rendering of your web applications: |
| 14 |
|
| 15 |
.. literalinclude:: ../examples/scheduling.py |
| 16 |
|
| 17 |
|
| 18 |
SSH into your server |
| 19 |
^^^^^^^^^^^^^^^^^^^^ |
| 20 |
You can SSH into your Python process and get a Python prompt, allowing you to |
| 21 |
poke around in the internals of your running program: |
| 22 |
|
| 23 |
.. literalinclude:: ../examples/ssh.py |
| 24 |
|
| 25 |
|
| 26 |
DNS query |
| 27 |
^^^^^^^^^ |
| 28 |
Twisted also has a fully featured DNS library: |
| 29 |
|
| 30 |
.. literalinclude:: ../examples/mxquery.py |
| 31 |
|
| 32 |
|
| 33 |
Using Crochet in normal Twisted code |
| 34 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 35 |
You can use Crochet's APIs for calling into the reactor thread from normal |
| 36 |
Twisted applications: |
| 37 |
|
| 38 |
.. literalinclude:: ../examples/fromtwisted.py |