<s> import time <EOL> import human_curl <EOL> import requests <EOL> import json <EOL> import uuid <EOL> from pprint import pprint <EOL> from contextlib import contextmanager <EOL> @ contextmanager <EOL> def timer ( func ) : <EOL> print ( "<STR_LIT>" % func ) <EOL> t = time . time ( ) <EOL> yield <EOL> print ( "<STR_LIT>" % ( str ( time . time ( ) - t ) , func ) ) <EOL> with timer ( "<STR_LIT>" ) : <EOL> r = human_curl . get ( '<STR_LIT>' , allow_redirects = True , <EOL> max_redirects = <NUM_LIT:10> ) <EOL> print ( r ) <EOL> print ( len ( r . history ) ) <EOL> with timer ( "<STR_LIT>" ) : <EOL> r = requests . get ( '<STR_LIT>' , allow_redirects = True ) <EOL> print ( r ) <EOL> print ( len ( r . history ) ) <EOL> files = { <EOL> '<STR_LIT>' : open ( "<STR_LIT>" ) , <EOL> '<STR_LIT>' : open ( "<STR_LIT>" ) , <EOL> } <EOL> with timer ( "<STR_LIT>" ) : <EOL> try : <EOL> r = human_curl . post ( '<STR_LIT>' , allow_redirects = True , files = files , <EOL> max_redirects = <NUM_LIT:10> ) <EOL> print ( r ) <EOL> except Exception , e : <EOL> print ( e ) <EOL> with timer ( "<STR_LIT>" ) : <EOL> try : <EOL> r = requests . post ( '<STR_LIT>' , allow_redirects = True , files = files ) <EOL> print ( r ) <EOL> except Exception , e : <EOL> print ( e ) <EOL> custom_headers = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) <EOL> with timer ( "<STR_LIT>" ) : <EOL> r = human_curl . get ( "<STR_LIT>" , <EOL> headers = custom_headers ) <EOL> print ( r ) <EOL> print ( json . loads ( r . content ) ) <EOL> custom_vars = { <EOL> uuid . uuid4 ( ) . hex : uuid . uuid4 ( ) . hex , <EOL> uuid . uuid4 ( ) . hex : uuid . uuid4 ( ) . hex , <EOL> uuid . uuid4 ( ) . hex : uuid . uuid4 ( ) . hex , <EOL> } <EOL> with timer ( '<STR_LIT>' ) : <EOL> r = human_curl . post ( "<STR_LIT>" , <EOL> data = custom_vars , debug = True ) <EOL> print ( r ) <EOL> print ( json . loads ( r . content ) ) </s>
