python http 认证 auth oauth 认证
来源:互联网 发布:怎么开淘宝直播间 编辑:程序博客网 时间:2024/05/20 12:22
# -*- coding: utf-8 -*-import requestsBASE_URL = 'https://api.github.com'def construct_url(end_point): return '/'.join([BASE_URL, end_point])def basic_auth(): """http基本认证""" response = requests.get(construct_url('user'), auth=('5********', '**********')) print response.text print response.request.headersbasic_auth()def basic_oauth(): headers = {'Authorization': 'token fafsffsfsfafasfasfasfsafafasf'} response = requests.get(construct_url('user'), headers=headers) print response.request.headers print response.text print response.status_codefrom requests.auth import AuthBaseclass GithubAuth(AuthBase): def __init__(self, token): self.token = token def __call__(self, r): #requests 加 headers r.headers['Authorization'] = ''.join(['token', self.token]) return rdef oauth_advanced(): auth = GithubAuth('fafsffsfsfafasfasfasfsafafasf') response = requests.get(construct_url('user'), auth=auth) print response.textoauth_advanced()
0 0
- python http 认证 auth oauth 认证
- OAuth认证
- Oauth认证
- OAuth认证
- Oauth认证
- OAUTH认证
- OAUTH认证
- OAuth认证
- OAuth认证
- Python网页HTTP认证
- thinkphp Auth 权限认证
- MongoDB auth认证
- thinkphp auth认证表
- 腾讯auth认证
- django.contirb.auth-认证
- django.contirb.auth-认证
- TP3.2.3 Auth认证
- twemproxy auth认证时序
- nginx负载均衡策略
- 2.3产品需求文档BRD
- 现在主流开源分布式系统架构都有哪些? dubbo zookeeper springmvc mybatis shiro restful redis
- css设置各种中文字体如雅黑、黑体、宋体、楷体等等
- 兔子只数问题
- python http 认证 auth oauth 认证
- Nacicat for Oracle 绿色版 亲测可用
- 内核写文件
- AssetBundle加载资源的过程
- 干货 | Generative Adversarial Networks(GAN)的现有工作(2016.02)
- 版本库
- 科锐课堂笔记:2017/4/5 输入输出
- 数据库数据execl导出
- android 相关知识整理