<jupyter_start><jupyter_text>http://docs.python-requests.org/en/master/<jupyter_code>import logging
from time import clock
import redis
import requests
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
r = requests.get('http://172.16.58.3:8888/')
r.status_code
r.headers['content-type']
r.encoding
###复杂参数, header

domain_load='''[{"productID":"%s","period":12,"amount":1,"action":"activate"},
    {"productID":"%s","period":24,"amount":1,"action":"activate"}]
    ''' %(id,id)


    payload = {'callback': 'jQuery111109917434921775314_1536892807565', 'data': domain_load,'_': time.time() }
    headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36',
               'referer':'https://wanwang.aliyun.com/help/price.html',
               'dnt':'1',
               'cookie':'aliyun_choice=CN; cna=whgiFOGePFgCAQ4RFiWJ++g4; ww_csrf=mNeuIX%2BW%2BM9YJWRFSylXTi482qFOnsTYCboXy8vdMUd0BerjRvWlXkODZkoD9fcxEWCTQdDx%2Bv4rJVI1420OLYy%2BiEmv9cpruR0tjgueQ6gRf3pzWM6FpB3n3svirgY54NAyF%2FmDN1Qwm3yFN5Z0hw%3D%3D; stk_lgn=98af63a6-8ab8-4f02-903a-5b2d65a06b60; JSESSIONID=D049DBF777773E9C51F2D8C418102B50; isg=BIuLzP6rVMkjp4idx3rxQ6YdGi9_Ksnoz6jQRf2IZ0ohHKt-hfAv8il68lxXPPea'
               ,'authority':'netcn.console.aliyun.com'}
    r = requests.get('https://netcn.console.aliyun.com/core/product/infostatic',params=payload,headers=headers)
## 复杂的post 消息
payload = '''{"version":"v1.0","componentName":"qcwss"}'''   
r = requests.post('http://wss.tencentyun.com/backend/domain/',data=payload)
    
r.json()
r.text
r.content<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.165377751338489, 'fraction_numerical': 0.10113027959547888, 'mean_word_length': 6.067226890756302, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '321527', 'license': 'MIT', 'n_tokens_mistral': 816, 'n_tokens_neox': 732, 'n_words': 66, 'path': 'libs-use/requests/requests-demo.ipynb', 'repo_name': 'weisong82/python_ecology_learning', 'size': '1683'}