[Twisted-Python] adding reactor as argument to getPage()?
Glyph Lefkowitz
glyph at twistedmatrix.com
Sat Jul 30 13:38:10 MDT 2016
> On Jul 30, 2016, at 5:03 AM, steven meier <commercials24 at yahoo.de> wrote:
>
> hi,
>
>
> after my last question which was answered with:
> ...the reactor should be passed in by the user...
>
> i ran into getPage(), the
> file: ./lib/python2.7/site-packages/twisted/web/client.py
> which contains getPage() imports the reactor at the top.
>
> it can be easily changed to add a argument to getPage() which passes it
> down to _makeGetter...
> then just comment out the import at the top and getPage() works when
> given a reactor as argument.
>
> probably breaking a lot of other code in that file.
>
> since getPage() is a method thats probably used a lot...did i understand
> the passing of the reactor or i did my mind go overboard?
>
>
> as a reminder: i want to use the qt5reactor to get some gui output
Don't use getPage. You want Agent.request <https://twistedmatrix.com/documents/16.3.0/api/twisted.web.client.Agent.html#request>, or possibly treq.get <http://treq.readthedocs.org>. getPage has a lot of problems and will be deprecated in a future release.
-glyph
More information about the Twisted-Python
mailing list