Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29102

Re: Batching HTTP requests with httplib (Python 2.7)

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 <cameron@cskk.homeip.net>
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 <cs@zip.com.au>
To Chicken McNuggets <chicken@mcnuggets.com>
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 <k2t90g$4e4$1@speranza.aioe.org>
User-Agent Mutt/1.5.21 (2010-09-15)
References <k2t90g$4e4$1@speranza.aioe.org>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.659.1347589892.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 13Sep2012 19:34, Chicken McNuggets <chicken@mcnuggets.com> 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 <cs@zip.com.au>

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Batching HTTP requests with httplib (Python 2.7) Chicken McNuggets <chicken@mcnuggets.com> - 2012-09-13 19:34 +0100
  Re: Batching HTTP requests with httplib (Python 2.7) Cameron Simpson <cs@zip.com.au> - 2012-09-14 12:31 +1000
    Re: Batching HTTP requests with httplib (Python 2.7) Chicken McNuggets <chicken@mcnuggets.com> - 2012-09-14 10:53 +0100
      Re: Batching HTTP requests with httplib (Python 2.7) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-14 06:56 -0400
      Re: Batching HTTP requests with httplib (Python 2.7) Cameron Simpson <cs@zip.com.au> - 2012-09-15 19:30 +1000
      Re: Batching HTTP requests with httplib (Python 2.7) Xavier Combelle <xavier.combelle@free.fr> - 2012-09-14 13:46 +0200
        Re: Batching HTTP requests with httplib (Python 2.7) Neil Cerutti <neilc@norwich.edu> - 2012-09-18 12:40 +0000

csiph-web