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


Groups > comp.lang.python > #100540

Re: error reading api with urllib

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: error reading api with urllib
Date Wed, 16 Dec 2015 16:22:49 -0700
Lines 15
Message-ID <mailman.25.1450308211.30845.python-list@python.org> (permalink)
References <9aa21642-765b-4666-8c66-a6dab9928c37@googlegroups.com> <f9370000-5b40-41e5-a355-471f3225c6ef@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de BygNBuDWrkcT4cPhN7f1WQQ70gFpRs+YTlcc3j/bmS0A==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:error': 0.11; 'syntax': 0.13; "'bad": 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:api': 0.16; 'subject:urllib': 0.16; 'unsupported': 0.16; 'wrote:': 0.16; 'string': 0.17; '2015': 0.20; 'dec': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'skip:u 20': 0.28; 'code:': 0.29; '15,': 0.30; 'tue,': 0.34; 'except': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=cHEx2s4CtvDhAAnQcIUn/74WFfnY1MKnx1MAtg+Vxug=; b=L3T7SBK09Vq4wqT71O4xyMZnBBLnQykTapPqSdzlZhOeLgB8aOmfoft+deQx6E+Ni3 yqb4uLqbtQ5sZ7s84t6ESl1JDSCNTAcW0W7JP3XO6s9/9MZvOrPyHMXxWsRVOyjBuMDr gZ9On3ZUFTSkoY0NuDvKetrG+3bcWe/Plv+ZzBdlFhsy0aP159YX9FBTuXsYGLyrNolG 3rWfgq+1Vy+weDwgoo8RMpZQ9DAfjUmFFOYEznkBpsLVQr7PGTlx2FGIm/zDlLBMD3nd rqvcYYL9p8vNVMOhjFTizHdi50aYbLLlBcVxwvvuKkf2LnWb8ojGyt9591u6CWFuuN3D 5NGg==
X-Received by 10.107.137.226 with SMTP id t95mr42883135ioi.188.1450308209043; Wed, 16 Dec 2015 15:23:29 -0800 (PST)
In-Reply-To <f9370000-5b40-41e5-a355-471f3225c6ef@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100540

Show key headers only | View raw


On Tue, Dec 15, 2015 at 7:46 PM, Simian <simian336@gmail.com> wrote:
> I added
>
> except urllib.error.HTTPError as e:
>      print('HTTP Errpr')
>      print('Error code: ', e.code)
>
> to my try and I recieve...
>
> 400: ('Bad Request',
>      'Bad request syntax or unsupported method'),
>
> but processing the string with a browser works fine.

Have you tried requesting the same URL with curl?

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


Thread

error reading api with urllib simian336@gmail.com - 2015-12-15 17:54 -0800
  Re: error reading api with urllib Simian <simian336@gmail.com> - 2015-12-15 18:46 -0800
    Re: error reading api with urllib Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-16 16:22 -0700
  Re: error reading api with urllib John Gordon <gordon@panix.com> - 2015-12-16 22:12 +0000
    Re: error reading api with urllib Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-16 16:24 -0700
  Re: error reading api with urllib Simian <simian336@gmail.com> - 2015-12-17 11:29 -0800

csiph-web