@@ -30,7 +30,11 @@ def test_list_datasets_sends_expected_request(self, mocker) -> None:
3030 )
3131 assert ("start_date" , "2018-01-01" ) in call ["params" ]
3232 assert ("end_date" , "2020-01-01" ) in call ["params" ]
33- assert call ["headers" ] == {"accept" : "application/json" }
33+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
34+ assert call ["headers" ]["accept" ] == "application/json"
35+ assert all (
36+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
37+ )
3438 assert call ["timeout" ] == (100 , 100 )
3539 assert isinstance (call ["auth" ], requests .auth .HTTPBasicAuth )
3640
@@ -54,7 +58,11 @@ def test_list_schemas_sends_expected_request(self, mocker) -> None:
5458 )
5559 assert ("start_date" , "2018-01-01" ) in call ["params" ]
5660 assert ("end_date" , "2021-01-01" ) in call ["params" ]
57- assert call ["headers" ] == {"accept" : "application/json" }
61+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
62+ assert call ["headers" ]["accept" ] == "application/json"
63+ assert all (
64+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
65+ )
5866 assert call ["timeout" ] == (100 , 100 )
5967 assert isinstance (call ["auth" ], requests .auth .HTTPBasicAuth )
6068
@@ -78,7 +86,11 @@ def test_list_fields_sends_expected_request(self, mocker) -> None:
7886 )
7987 assert ("schema" , "mbo" ) in call ["params" ]
8088 assert ("encoding" , "dbz" ) in call ["params" ]
81- assert call ["headers" ] == {"accept" : "application/json" }
89+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
90+ assert call ["headers" ]["accept" ] == "application/json"
91+ assert all (
92+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
93+ )
8294 assert call ["timeout" ] == (100 , 100 )
8395 assert isinstance (call ["auth" ], requests .auth .HTTPBasicAuth )
8496
@@ -96,7 +108,11 @@ def test_list_encodings_sends_expected_request(self, mocker) -> None:
96108 call ["url" ]
97109 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.list_encodings"
98110 )
99- assert call ["headers" ] == {"accept" : "application/json" }
111+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
112+ assert call ["headers" ]["accept" ] == "application/json"
113+ assert all (
114+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
115+ )
100116 assert call ["timeout" ] == (100 , 100 )
101117 assert isinstance (call ["auth" ], requests .auth .HTTPBasicAuth )
102118
@@ -114,7 +130,11 @@ def test_list_compressions_sends_expected_request(self, mocker) -> None:
114130 call ["url" ]
115131 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.list_compressions" # noqa
116132 )
117- assert call ["headers" ] == {"accept" : "application/json" }
133+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
134+ assert call ["headers" ]["accept" ] == "application/json"
135+ assert all (
136+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
137+ )
118138 assert call ["timeout" ] == (100 , 100 )
119139 assert isinstance (call ["auth" ], requests .auth .HTTPBasicAuth )
120140
@@ -145,7 +165,11 @@ def test_list_unit_price_sends_expected_request(
145165 call ["url" ]
146166 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.list_unit_prices"
147167 )
148- assert call ["headers" ] == {"accept" : "application/json" }
168+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
169+ assert call ["headers" ]["accept" ] == "application/json"
170+ assert all (
171+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
172+ )
149173 assert call ["params" ] == [
150174 ("dataset" , "glbx.mdp3" ),
151175 ("mode" , "live" ),
@@ -175,7 +199,11 @@ def test_get_shape_sends_expected_request(self, mocker) -> None:
175199 call ["url" ]
176200 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.get_shape"
177201 )
178- assert call ["headers" ] == {"accept" : "application/json" }
202+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
203+ assert call ["headers" ]["accept" ] == "application/json"
204+ assert all (
205+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
206+ )
179207 assert call ["params" ] == [
180208 ("dataset" , "glbx.mdp3" ),
181209 ("symbols" , "ESH1" ),
@@ -210,7 +238,11 @@ def test_get_billable_size_sends_expected_request(self, mocker) -> None:
210238 call ["url" ]
211239 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.get_billable_size" # noqa
212240 )
213- assert call ["headers" ] == {"accept" : "application/json" }
241+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
242+ assert call ["headers" ]["accept" ] == "application/json"
243+ assert all (
244+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
245+ )
214246 assert call ["params" ] == [
215247 ("dataset" , "glbx.mdp3" ),
216248 ("symbols" , "ESH1" ),
@@ -245,7 +277,11 @@ def test_get_cost_sends_expected_request(self, mocker) -> None:
245277 call ["url" ]
246278 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.get_cost"
247279 )
248- assert call ["headers" ] == {"accept" : "application/json" }
280+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
281+ assert call ["headers" ]["accept" ] == "application/json"
282+ assert all (
283+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
284+ )
249285 assert call ["params" ] == [
250286 ("dataset" , "glbx.mdp3" ),
251287 ("symbols" , "ESH1" ),
@@ -277,7 +313,11 @@ def test_get_license_fee_sends_expected_request(self, mocker) -> None:
277313 call ["url" ]
278314 == f"https://hist.databento.com/v{ db .API_VERSION } /metadata.get_license_fee"
279315 )
280- assert call ["headers" ] == {"accept" : "application/json" }
316+ assert sorted (call ["headers" ].keys ()) == ["accept" , "user-agent" ]
317+ assert call ["headers" ]["accept" ] == "application/json"
318+ assert all (
319+ v in call ["headers" ]["user-agent" ] for v in ("Databento/" , "Python/" )
320+ )
281321 assert call ["params" ] == [
282322 ("dataset" , "glbx.mdp3" ),
283323 ("purposes" , "professional trading" ),
0 commit comments