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


Groups > comp.lang.python > #60142 > unrolled thread

Re: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

Started byLogan <logan@s1network.com>
First post2013-11-20 18:26 -0500
Last post2013-11-20 18:26 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3) Logan <logan@s1network.com> - 2013-11-20 18:26 -0500

#60142 — Re: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

FromLogan <logan@s1network.com>
Date2013-11-20 18:26 -0500
SubjectRe: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)
Message-ID<mailman.2992.1384989946.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On 11/20/2013 02:05 AM, Chris Angelico wrote:
> On Wed, Nov 20, 2013 at 1:14 PM, Logan <logan@s1network.com> wrote:
>> Chris,
>>
>> That is genius.  Thank you!
> Then it works? Awesome!! (Permit me an evil laugh. Muahahahaaaa!)
>
> This is why I love working with open source languages. Even if you
> don't end up actually changing anything, you can go and snoop the code
> and see what happens - sometimes you can tweak your code based on that
> knowledge. And hey. This is duck typing at its best!
>
> ChrisA
>
Not exactly as written, but close enough to get me working.  At one 
point the following code is executed, turning the value into a string to 
be  "title"d next time it is called:

    name = name.title()


So, I worked around it with the following class, adapted from yours:

    class CaseSensitiveHeader(object):
         def __init__(self, name):
             self.name = name

         def capitalize(self):
             return self

         def title(self):
             return self

         def lower(self):
             return self.name

         def encode(self, encoding):
    return self.name.encode(encoding)


With that, I am now able to post a case sensitive HTTP header.

-- Logan

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web