Задать вопрос

Тел: +7 965 3737 888

509

Просмотров

0

Ответов

Custom requests auth class for Tastypie API key authentication

<p>In case you ever use <a href="http://python-requests.org/">requests</a> (or <a href="http://slumber.in/">slumber</a>) to do requests against a Tastypie API that requires API key authentication, this small custom auth class will help you.</p>
<p>Use it like that (with requests):</p>
auth = TastypieApiKeyAuth('jezdez', '25fdd0d9d210acb78b5b845fe8284a3c93630252')
response = requests.get('http://api.foo.bar/v1/spam/', auth=auth)

<p>or with slumber:</p>
auth = TastypieApiKeyAuth('jezdez', '25fdd0d9d210acb78b5b845fe8284a3c93630252')
api = slumber.API("http://api.foo.bar/v1/", auth=auth)
spam = api.spam().get()

Вопрос полезен? Да0/Нет0
file_3876.py(431.0б)
None