A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/praw-dev/praw/commit/252083ef1dbfe6ea53c2dc99ac235b4ba330b658 below:

Removed praw-multiprocess and MultiProcessHandler. · praw-dev/praw@252083e · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+9

-254

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+9

-254

lines changed Original file line number Diff line number Diff line change

@@ -10,6 +10,14 @@ upstream changes.

10 10 11 11

.. begin_changelog_body

12 12 13 +

4.0.0a1

14 +

-------

15 + 16 +

**Removed**

17 + 18 +

* Removed `praw-multiprocess` and its associated ``MultiprocessHandler``. This

19 +

functionality is no longer needed with PRAW4.

20 + 13 21

3.4.0 (2016-02-21)

14 22

------------------

15 23 Original file line number Diff line number Diff line change

@@ -19,7 +19,6 @@ Content Pages

19 19

pages/comment_parsing

20 20

pages/oauth

21 21

pages/lazy-loading

22 -

pages/multiprocess

23 22

pages/contributor_guidelines

24 23

pages/configuration_files

25 24

pages/faq

Original file line number Diff line number Diff line change

@@ -50,9 +50,7 @@ Step 2: Setting up PRAW.

50 50 51 51

If you want to persist instances of PRAW across multiple requests in a web

52 52

application, we recommend that you create an new instance per distinct

53 -

authentication. Furthermore, if your web application spawns multiple

54 -

processes, it is highly recommended that you utilize PRAW's

55 -

:ref:`multiprocess <multiprocess>` functionality.

53 +

authentication.

56 54 57 55

We start as usual by importing the PRAW package and creating a :class:`.Reddit`

58 56

object with a clear and descriptive useragent that follows the `api rules

Original file line number Diff line number Diff line change

@@ -1,16 +1,11 @@

1 1

"""Provides classes that handle request dispatching."""

2 2 3 3

from __future__ import print_function, unicode_literals

4 - 5 -

import socket

6 -

import sys

7 4

import time

8 5

from functools import wraps

9 -

from praw.errors import ClientException

10 6

from praw.helpers import normalize_url

11 7

from requests import Session

12 8

from six import text_type

13 -

from six.moves import cPickle # pylint: disable=F0401

14 9

from threading import Lock

15 10

from timeit import default_timer as timer

16 11

@@ -181,59 +176,3 @@ def evict(cls, urls):

181 176

del cls.timeouts[key]

182 177

return retval

183 178

DefaultHandler.request = DefaultHandler.with_cache(RateLimitHandler.request)

184 - 185 - 186 -

class MultiprocessHandler(object):

187 -

"""A PRAW handler to interact with the PRAW multi-process server."""

188 - 189 -

def __init__(self, host='localhost', port=10101):

190 -

"""Construct an instance of the MultiprocessHandler."""

191 -

self.host = host

192 -

self.port = port

193 - 194 -

def _relay(self, **kwargs):

195 -

"""Send the request through the server and return the HTTP response."""

196 -

retval = None

197 -

delay_time = 2 # For connection retries

198 -

read_attempts = 0 # For reading from socket

199 -

while retval is None: # Evict can return False

200 -

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

201 -

sock_fp = sock.makefile('rwb') # Used for pickle

202 -

try:

203 -

sock.connect((self.host, self.port))

204 -

cPickle.dump(kwargs, sock_fp, cPickle.HIGHEST_PROTOCOL)

205 -

sock_fp.flush()

206 -

retval = cPickle.load(sock_fp)

207 -

except: # pylint: disable=W0702

208 -

exc_type, exc, _ = sys.exc_info()

209 -

socket_error = exc_type is socket.error

210 -

if socket_error and exc.errno == 111: # Connection refused

211 -

sys.stderr.write('Cannot connect to multiprocess server. I'

212 -

's it running? Retrying in {0} seconds.\n'

213 -

.format(delay_time))

214 -

time.sleep(delay_time)

215 -

delay_time = min(64, delay_time * 2)

216 -

elif exc_type is EOFError or socket_error and exc.errno == 104:

217 -

# Failure during socket READ

218 -

if read_attempts >= 3:

219 -

raise ClientException('Successive failures reading '

220 -

'from the multiprocess server.')

221 -

sys.stderr.write('Lost connection with multiprocess server'

222 -

' during read. Trying again.\n')

223 -

read_attempts += 1

224 -

else:

225 -

raise

226 -

finally:

227 -

sock_fp.close()

228 -

sock.close()

229 -

if isinstance(retval, Exception):

230 -

raise retval # pylint: disable=E0702

231 -

return retval

232 - 233 -

def evict(self, urls):

234 -

"""Forward the eviction to the server and return its response."""

235 -

return self._relay(method='evict', urls=urls)

236 - 237 -

def request(self, **kwargs):

238 -

"""Forward the request to the server and return its HTTP response."""

239 -

return self._relay(method='request', **kwargs)

Original file line number Diff line number Diff line change

@@ -36,8 +36,6 @@

36 36

description=('PRAW, an acronym for `Python Reddit API Wrapper`, is a '

37 37

'python package that allows for simple access to '

38 38

'reddit\'s API.'),

39 -

entry_points={'console_scripts': [

40 -

'praw-multiprocess = praw.multiprocess:run']},

41 39

install_requires=['decorator >=4.0.9, <4.1',

42 40

'requests >=2.3.0',

43 41

'six ==1.10',

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4