[Tutor] Python Websocket Server

2019-02-14 Thread Simon Connah
Hi, I was wondering what the best practice for writing web socket servers in Python was in 2019? I found an old example on the web which used the tornado library but that was talking about Chrome 22 as the client which is ancient now so I'm not sure if things have changed? Any suggestions

Re: [Tutor] Extract main text from HTML document

2018-05-07 Thread Simon Connah
That looks like a useful combination. Thanks. On 6 May 2018 at 17:32, Mark Lawrence <breamore...@gmail.com> wrote: > On 05/05/18 18:59, Simon Connah wrote: >> >> Hi, >> >> I'm writing a very simple web scraper. It'll download a page from a >> website

Re: [Tutor] Extract main text from HTML document

2018-05-06 Thread Simon Connah
May 2018 at 22:43, boB Stepp <robertvst...@gmail.com> wrote: > On Sat, May 5, 2018 at 12:59 PM, Simon Connah <scopensou...@gmail.com> wrote: > >> I was wondering if there was a way in which I could download a web >> page and then just extract the main body of text wit

[Tutor] Extract main text from HTML document

2018-05-05 Thread Simon Connah
Hi, I'm writing a very simple web scraper. It'll download a page from a website and then store the result in a database of some sort. The problem is that this will obviously include a whole heap of HTML, JavaScript and maybe even some CSS. None of which is useful to me. I was wondering if there

[Tutor] Async TCP Server

2018-04-25 Thread Simon Connah
Hi, I've come up with an idea for a new protocol I want to implement in Python using 3.6 (or maybe 3.7 when that comes out), but I'm somewhat confused about how to do it in an async way. The way I understand it is that you have a loop that waits for an incoming request and then calls a

Re: [Tutor] Proper way to unit test the raising of exceptions?

2018-04-01 Thread Simon Connah via Tutor
a perfect fit for that particular problem. Thanks again. All of your help is much appreciated. On Sunday, 1 April 2018, 16:32:11 BST, Mats Wichmann <m...@wichmann.us> wrote: On 04/01/2018 09:10 AM, Peter Otten wrote: > Simon Connah via Tutor wrote: > >> Hi, >>

[Tutor] Proper way to unit test the raising of exceptions?

2018-04-01 Thread Simon Connah via Tutor
Hi, I'm just wondering what the accepted way to handle unit testing exceptions is? I know you are meant to use assertRaises, but my code seems a little off. try:    some_func() except SomeException:    self.assertRaises(SomeException) Is there a better way to do this at all? The problem with the

[Tutor] Does the secrets module in Python 3.6 use a hardware RNG like that provided in Intel CPUs?

2018-03-09 Thread Simon Connah via Tutor
Hi, I was reading through the secrets documentation in Python 3.6 and noticed that it uses /dev/urandom but I'm unsure if that means it'll use a hardware RNG or just one provided by the operating system (Linux / Windows / etc) in software. The question is is it possible to determine the source