File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
src/procurement_tools/cli Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 3
3
from procurement_tools import FAR , USASpending , SAM , SBIR
4
4
from procurement_tools .models .opportunities import OpportunitiesRequestParams
5
5
import typer
6
+ from typing import Optional
6
7
from typing_extensions import Annotated
7
8
8
9
app = typer .Typer ()
@@ -34,21 +35,25 @@ def entity(uei: str):
34
35
def opportunities (
35
36
* ,
36
37
q : str = "" ,
37
- postedFrom : str = datetime .now ().strftime ("%Y-%m-%d" ),
38
- postedTo : str = datetime .now ().strftime ("%Y-%m-%d" ),
38
+ postedFrom : Optional [
39
+ str
40
+ ] = None , # (datetime.now() - timedelta(days=364)).strftime("%Y-%m-%d"),
41
+ postedTo : Optional [str ] = None , # datetime.now().strftime("%Y-%m-%d"),
39
42
active : str = "true" ,
40
43
mode : str = "ALL" ,
41
44
):
42
45
"""Get SAM opportunities' JSON data"""
43
- res = SAM .get_opportunities (
44
- {
45
- "q" : q ,
46
- "modified_date.from" : postedFrom + "-06:00" ,
47
- "modified_date.to" : postedTo + "-06:00" ,
48
- "active" : active ,
49
- "mode" : mode ,
50
- }
51
- )
46
+ params = {
47
+ "q" : q ,
48
+ "active" : active ,
49
+ "mode" : mode ,
50
+ }
51
+ if postedFrom :
52
+ params ["modified_date.from" ] = (postedFrom + "-06:00" ,)
53
+ if postedTo :
54
+ params ["modified_date.to" ] = (postedTo + "-06:00" ,)
55
+
56
+ res = SAM .get_opportunities (params )
52
57
print (json .dumps (res ))
53
58
54
59
You can’t perform that action at this time.
0 commit comments