File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,3 +4,6 @@ python-dateutil
44responses
55mock
66setuptools_scm
7+ MarkupSafe
8+ setuptools >= 40.0
9+ configparser >= 3.5
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ def __init__(self,
2929 self ._access_token = access_token
3030 self ._access_token_secret = access_token_secret
3131 self ._options = kwargs .get ('options' , {})
32+ self ._headers = kwargs .get ('headers' , {})
3233
3334 def __repr__ (self ):
3435 return '<{name} object at {mem} consumer_key={key}>' .format (
@@ -42,6 +43,11 @@ def options(self):
4243 """Returns the options value."""
4344 return self ._options
4445
46+ @property
47+ def headers (self ):
48+ """Returns the headers value."""
49+ return self ._headers
50+
4551 @property
4652 def consumer_key (self ):
4753 """Returns the consumer_key value."""
Original file line number Diff line number Diff line change @@ -75,10 +75,12 @@ def __oauth_request(self):
7575 if 'headers' in self .options :
7676 headers .update (self .options ['headers' ].copy ())
7777
78- # internal-only
78+ # DEPRECATED: internal-only (Should pass a header to the client)
7979 if 'x-as-user' in self ._client .options :
8080 headers ['x-as-user' ] = self ._client .options .get ('x-as-user' )
81-
81+ # Add headers from the client to the request (Client headers take priority)
82+ for key , val in self ._client .headers .items ():
83+ headers [key ] = val
8284 params = self .options .get ('params' , None )
8385 data = self .options .get ('body' , None )
8486 files = self .options .get ('files' , None )
You can’t perform that action at this time.
0 commit comments