Esempio n. 1
0
    def add_start_date(self, input, start_date_type):
        try:
            datetime.strptime(input, "%Y-%m-%d")
        except:
            error.ParamsInvalidError(
                "end_date requires a date object in %Y-%m-%d format")

        if str(start_date_type) not in [
                'earliest_file_date', 'application_date', 'publication_date',
                'grant_date', 'expiration_date'
        ]:
            raise error.ParamsInvalidError(
                "end_date_type must be 'earliest_date_filed','application_date', 'publication_date','grant_date', or 'expiration_date'."
            )
        else:
            self.q['start_date'] = input
            self.q['start_date_type'] = start_date_type
Esempio n. 2
0
    def add_max_expected_results(self, input):
        if type(input) is not int:
            raise error.ParamsInvalidError(
                "max_expected_results should be an int")
        else:
            self.q['max_expected_results'] = input

        if input > self.query_is_big:
            print(
                "Your response size will be very large, expect query to take a long time."
            )
Esempio n. 3
0
 def add_offset(self, input):
     if type(input) is not int:
         raise error.ParamsInvalidError("offset should be an int")
     else:
         self.q['offset'] = input
Esempio n. 4
0
 def add_page_size(self, input):
     if type(input) is not int:
         raise error.ParamsInvalidError("page_size should be an int")
     else:
         self.q['page_size'] = input
Esempio n. 5
0
 def add_expired(self, input):
     if input not in ['True', 'False']:
         raise error.ParamsInvalidError(
             "add_granted accepts only True or False")
     else:
         self.q['expired'] = input