Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'things.': 0.05; 'executed': 0.07; 'wrapper': 0.07; 'function:': 0.09; 'subject:2.7': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'library': 0.15; 'essentials': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'mcnuggets': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'sequential': 0.16; 'simpson': 0.16; 'subject:requests': 0.16; 'wrote:': 0.17; '(or': 0.18; 'bit': 0.21; 'http': 0.22; 'lets': 0.22; 'runs': 0.22; 'cc:2**0': 0.23; 'task': 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'wondering': 0.26; 'mike': 0.27; 'appreciated': 0.27; 'credentials': 0.29; "i'm": 0.29; 'maybe': 0.29; 'worked': 0.30; 'generally': 0.32; 'certain': 0.33; 'problem': 0.33; 'list': 0.35; 'whatever': 0.35; 'there': 0.35; 'received:au': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.36; 'subject: (': 0.36; 'subject:: ': 0.38; 'help': 0.40; 'your': 0.60; 'content-disposition:inline': 0.60; 'most': 0.61; 'procedure': 0.61; 'show': 0.63; 'services': 0.64; ':).': 0.84; 'photographs': 0.84; 'regarded': 0.84; 'services?': 0.84; 'oil': 0.93 Date: Fri, 14 Sep 2012 12:31:28 +1000 From: Cameron Simpson To: Chicken McNuggets Subject: Re: Batching HTTP requests with httplib (Python 2.7) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) References: Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347589892 news.xs4all.nl 6910 [2001:888:2000:d::a6]:38793 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29102 On 13Sep2012 19:34, Chicken McNuggets wrote: | I'm writing a simple library that communicates with a web service and am | wondering if there are any generally well regarded methods for batching | HTTP requests? | | The problem with most web services is that they require a list of | sequential commands to be executed in a certain order to complete a | given task (or at least the one I am using does) so having to manually | call each command is a bit of a pain. How would you go about the design | of a library to interact with these services? | | Any help is greatly appreciated :). Maybe I'm missing something. What's hard about: - wrapping the web services calls in a simple wrapper which composes the call, runs it, and returns the result parts This lets you hide all the waffle about the base URL, credentials etc in the wrapper and only supply the essentials at call time. - writing your workflow thing then as a simple function: def doit(...): web_service_call1(...) web_service_call2(...) web_service_call3(...) with whatever internal control is required? This has worked for me for simple things. What am I missing about the larger context? -- Cameron Simpson Clymer's photographs of this procedure show a very clean head. This is a lie. There is oil in here, and lots of it. - Mike Mitten, rec.moto, 29sep1993