#twisted

/

      • vrederv has quit
      • dhanush joined the channel
      • hellais_ has quit
      • foom joined the channel
      • runciter has quit
      • jstanley_ joined the channel
      • jstanley has quit
      • faldridge joined the channel
      • faldridge has quit
      • faldridge joined the channel
      • dhanush joined the channel
      • kenaan
        Lukasa reviewed <https://tm.tl/#8530>; - Delete test_webclient.py's testPartial() test, which is being skipped (assigned to rodrigc)
      • t0mb0_ joined the channel
      • new core enhancement https://tm.tl/#8532 by adiroiban: Push coverage report from Travis-CI
      • vrederv joined the channel
      • insp3ori0n joined the channel
      • insp3ori0n
        hey guys :) jjust a little question. can i send files with self.transport.write just out of the box or do i have do decode them in some way?
      • LionsMane joined the channel
      • jstanley_ has quit
      • jstanley joined the channel
      • clokep
        insp3ori0n: That's probably not a super simple question...you can probably *generally* do it (especially if it's a binary file), otherwise you'll need to deal with some sort of text encoding.
      • (Although if you can control both sides that's not hard.)
      • insp3ori0n
        clokep: i managed it now easily with file = open(...), data=file.read()... but in case of, for example pdf files this would not work
      • clokep
        Why not?
      • Data is just data...
      • insp3ori0n
        i think they cant be transfered to a string or im wrong?
      • clokep
        with open(..., 'rb') as f: self.transport.send(f.read())
      • insp3ori0n
        works with pdfs too?? good to know
      • clokep
        insp3ori0n: Twisted works on "bytes" which is called "string" in Python 2, "bytes" in Python 3, essentially just a collection of data with no understanding of what it is underneath.
      • So if oyu send it and then save it back to a pdf on the other end, it should work OK.
      • insp3ori0n
        thanks a lot, got it now :)
      • tonythomas joined the channel
      • terrycojones joined the channel
      • insp3ori0n has quit
      • kenaan
        Tickets pending review: https://tm.tl/#8308, #8332, #8368, #8469 (Lukasa), #8478, #8480, #8494, #8491, #8515, #8526, #8511, #8519, #8531, #8524, #3807, #5786, #8209, #7868, #8026, #5705
      • goldfish joined the channel
      • khorn joined the channel
      • ssbr joined the channel
      • dstufft joined the channel
      • terrycojones has quit
      • average joined the channel
      • average
        so I wrote an app using twisted.web.resource
      • it's a web app, perhaps you would call it a web server
      • it has some logic that does some requests elsewhere, and computes a result based on that and returns it
      • some of its requests are built using NOT_DONE_YET
      • what are my chances of transitioning to WSGI ? (the point of this would be to deploy the app with uWSGI and be able to take advantage of the reload/restart triggered via memory utilization that uWSGI provides. because for some reason, the twisted app I wrote, leaks memory, and I am not fully confident that I'll be able to tame those leaks in due time, so I need it to be combed up and reloaded/restarted when it goes over a certain limit, for example
      • I am asking this in relation to a quote in the documentation, which says "Like any other WSGI container, you can’t do anything asynchronous in your WSGI applications, even though this is a Twisted WSGI container.
      • "
      • This quote somehow makes me feel that the async requests I'm doing in the twisted app (via twisted.web.client , specifically Agent) will be neutralized and forced to synchronous mode if I were to transition the twisted app to WSGI
      • I'm not sure if there's any truth to that, maybe someone else would like to weigh in
      • dude-x joined the channel
      • vrederv has quit
      • itamarst joined the channel
      • jordanl joined the channel
      • mat^2 joined the channel
      • vshyba2 is now known as vshyba
      • average has left the channel
      • aenglander joined the channel
      • tonythomas has quit
      • kenaan
        GitHub <noreply@github.com>; closed <https://tm.tl/#8530>; - Delete test_webclient.py's testPartial() test, which is being skipped
      • iffy joined the channel
      • dsea11 joined the channel
      • dsea11 has quit
      • marcidy has quit
      • marcidy joined the channel
      • marcidy has quit
      • marcidy joined the channel
      • adourado joined the channel
      • terrycojones joined the channel
      • terrycojones has quit
      • adourado
        So, I have a program that makes HTTP requests with twisted's Agent and we're moving to HTTPS, but with a self-signed certificate. I made it work with a custom ClientContextFactory, but how would I go about making it work properly, without completely ignoring the certificate
      • ?
      • iffy has left the channel
      • jstanley has quit
      • jstanley joined the channel
      • terrycojones joined the channel
      • mesozoic joined the channel
      • mesozoic_ has quit
      • dpn`
        adourado, i'm pretty sure treq has answered this question, maybe check it out
      • is always takes me a significant amount of time to get ampoule working after I haven't used it for a while :(
      • child processes seem to be exiting without getting a chance to do anything
      • ardu_ joined the channel
      • benbangert
        the joy of trying to clean the reactor of cached connections from the http Agent.....arrrrrrrgghghhhhhhh
      • dpn`
        benbangert, if you're using the default pool there's a secret global thingy isnt there?
      • wait.. that's in treq
      • I just assume everyone uses it :P
      • if not, maybe you could rip it off from there
      • benbangert
        I've had to dig through so many damn secret attributes to grab this connection pool. lol
      • dpn`
        haha yeah that sounds familiar
      • benbangert
        a ridiculous amount of time spent just to shut it down, its kind of insane
      • glyph: fix it! ;)
      • dpn`
        FWIW this is what I'm thinking of benbangert https://github.com/twisted/treq/blob/master/tre...
      • benbangert
        ah, well, I did finally reach the connection pool, though for some reason the underlying tcp client is alive, no idea why, but twisted trials is still unhappy about reactor
      • dpn`
        ah... the whole request wrapped in a request thing
      • trying to find the one with the actual transport on it :/
      • adourado
        dpn`: who/what is treq, and how do I check it out?
      • benbangert
        yea, maybe. thinking at this point of just grabbing the selectables off the reactor and nuking them
      • adourado
        dpn`: is it on the channel logs?
      • dpn`
      • it's a wrapper around Agent that makes it more like the regular python requests lib
      • adourado
        Hmmm
      • I was shooting for a less radical solution
      • It's a "here be dragons" part of the code
      • =/
      • dpn`
        adourado, here's the ticket addressing that I think: https://github.com/twisted/treq/issues/28
      • marcidy has quit
      • adourado
        dpn`: So I basically have to do this:
      • + pemFile = filepath.FilePath('server.pem').getContent()
      • + certificate = ssl.Certificate.loadPEM(pemFile)
      • + customPolicy = client.BrowserLikePolicyForHTTPS(certificate)
      • ?
      • I was hoping there was a way to do it without needing to distribute the certificate with the application
      • marcidy joined the channel
      • marcidy has quit
      • marcidy joined the channel
      • LionsMane has quit
      • dpn`
        adourado, you could fetch it from somewhere on app startup
      • you have to distribute it somehow...
      • adourado
        Got it
      • Seems like we'll actually have a proper certificate for the production environment, the self-signed one is just for test
      • I suppose it would work fine them, with a proper certificate? The docs on the Agent class says it supports HTTPS transparently
      • mesozoic has quit
      • dpn`
        adourado, generally it should be on par with whatever browsers use
      • so, comparable to curl i suppose? it's been a while since I looked at the specifics
      • adourado
        dpn`: got it. Fingers crossed =)
      • dpn`
        FWIW we use a proper cert for our staging env too
      • mesozoic joined the channel
      • kenaan
        Tickets pending review: https://tm.tl/#8308, #8332, #8368, #8469 (Lukasa), #8478, #8480, #8494, #8491, #8515, #8526, #8511, #8519, #8531, #8524, #3807, #5786, #8209, #7868, #8026, #5705
      • dpn`
        either as a subdomain or similar domain to our prod env
      • adourado
        dpn`: checking it now with team leader. I'm betting we won't use proper cert on dev
      • cjrh joined the channel
      • clokep has quit
      • kenaan
        new core enhancement https://tm.tl/#8533 by rodrigc: Mark twisted.internet.defer.TimeoutError as Deprecated
      • benbangert
        yea, I can't kill the damn thing
      • gonna have to reach into the reactor and remove the selectables via extra gross mechanisms
      • editshare-ericf joined the channel
      • mesozoic has quit
      • mesozoic joined the channel
      • tomprince
        benbangert: I guess you've tried agent.pool.closeCachedConnections() and waited on the deferred it returns?
      • benbangert
        yup, no help
      • did stopListening on the server, chained its deferred to closeCachedConnections.... dirty reactor still present
      • maybe there's more pools hiding out somewhere
      • this is the raven client's twisted transport, so its kinda goofy
      • tomprince
        benbangert: Can you see what kind of object is being waited on?
      • Is it perhaps the server protocol?
      • dpn`
        benbangert, are they connections that are being held open by naughty web servers?
      • benbangert
        there's an odd traceback
      • dpn`
        (are you hitting third party servers?)
      • benbangert
        nope, its a localhost test