Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: error reading api with urllib Date: Wed, 16 Dec 2015 16:22:49 -0700 Lines: 15 Message-ID: References: <9aa21642-765b-4666-8c66-a6dab9928c37@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de BygNBuDWrkcT4cPhN7f1WQQ70gFpRs+YTlcc3j/bmS0A== Return-Path: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100540 On Tue, Dec 15, 2015 at 7:46 PM, Simian 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?