@@ -137,6 +137,7 @@ def _call_project_api_raw(
137137 method : Optional [str ] = None ,
138138 params : Optional [dict ] = None ,
139139 data : Optional [dict ] = None ,
140+ header : Optional [dict ] = None ,
140141 ) -> RequestResponse :
141142 """
142143 Call project API endpoint.
@@ -152,6 +153,7 @@ def _call_project_api_raw(
152153 method: Method of the HTTP request, e.g. `"GET"`, `"POST"`, etc.
153154 params: HTTP(S) query parameters in form of a dictionary.
154155 data: Data to be sent in form of a dictionary.
156+ header: HTTP request header, dict that will update default headers
155157
156158 Returns:
157159 `RequestResponse` object containing response.
@@ -167,6 +169,7 @@ def _call_project_api_raw(
167169 method = method ,
168170 params = params ,
169171 data = data ,
172+ header = header ,
170173 )
171174
172175 def _get_project_url (self , * args , add_fork_part = True , add_api_endpoint_part = True ):
@@ -462,14 +465,21 @@ def add_user_or_group(
462465 def change_token (self , new_token : str ) -> None :
463466 self .service .change_token (new_token )
464467
465- def get_file_content (self , path : str , ref = None ) -> str :
468+ def get_file_content (
469+ self ,
470+ path : str ,
471+ ref : Optional [str ] = None ,
472+ headers : Optional [dict [str , str ]] = None ,
473+ ) -> str :
466474 ref = ref or self .default_branch
475+ headers = {"Accept" : "text/plain" , ** (headers or {})}
467476 result = self ._call_project_api_raw (
468477 "raw" ,
469478 ref ,
470479 "f" ,
471480 path ,
472481 add_api_endpoint_part = False ,
482+ header = headers ,
473483 )
474484
475485 if not result or result .status_code == HTTPStatus .NOT_FOUND :
0 commit comments