Re: [flask] Testing Basic Authentication
- From:
- Christoph Heer
- Date:
- 2011-08-21 @ 14:54
Thanks Alex,
I found a way to make a request over the test_client of flask with
basic auth (https://gist.github.com/1160696). But now I work with the
upload of files and than it is simpler to use requests as the
test_client.
Christoph
2011/8/11 Alex <thinkpragmatic@gmail.com>:
> You could use the requests module to manage basic auth
>
>>>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
>>>> r.status_code
> 200
>>>> r.headers['content-type']
> 'application/json'
>
> See: http://docs.python-requests.org/en/latest/index.html
>
>
> Alex
>
> On Wed, Aug 10, 2011 at 9:06 PM, Christoph Heer
> <christoph.heer@googlemail.com> wrote:
>> Hello,
>>
>> I want to unittest my application but how I can add HTTP Basic
>> Authentication to the function .get() and the other methods?
>> I hope someone can help me. Thanks!
>>
>> Best regards
>> Christoph
>>
>