|
23 | 23 | form_S1_424B4_endpoint = "https://api.sec-api.io/form-s1-424b4" |
24 | 24 | form_d_api_endpoint = "https://api.sec-api.io/form-d" |
25 | 25 | form_C_endpoint = "https://api.sec-api.io/form-c" |
| 26 | +reg_A_search_all_endpoint = "https://api.sec-api.io/reg-a/search" |
| 27 | +form_1A_endpoint = "https://api.sec-api.io/reg-a/form-1a" |
| 28 | +form_1K_endpoint = "https://api.sec-api.io/reg-a/form-1k" |
| 29 | +form_1Z_endpoint = "https://api.sec-api.io/reg-a/form-1z" |
26 | 30 | # |
27 | 31 | form_8K_item_4_02_api_endpoint = "https://api.sec-api.io/form-8k" |
28 | 32 | form_8K_item_x_api_endpoint = "https://api.sec-api.io/form-8k" |
@@ -578,6 +582,118 @@ def get_data(self, query): |
578 | 582 | handle_api_error(response) |
579 | 583 |
|
580 | 584 |
|
| 585 | +class RegASearchAllApi: |
| 586 | + """ |
| 587 | + Base class for Regulation A Search All API |
| 588 | + https://sec-api.io/docs/reg-a-offering-statements-api#search-api-endpoint |
| 589 | + """ |
| 590 | + |
| 591 | + def __init__(self, api_key, proxies=None): |
| 592 | + self.api_key = api_key |
| 593 | + self.api_endpoint = reg_A_search_all_endpoint + "?token=" + api_key |
| 594 | + self.proxies = proxies if proxies else {} |
| 595 | + |
| 596 | + def get_data(self, query): |
| 597 | + response = {} |
| 598 | + |
| 599 | + for x in range(3): |
| 600 | + response = requests.post( |
| 601 | + self.api_endpoint, json=query, proxies=self.proxies |
| 602 | + ) |
| 603 | + if response.status_code == 200: |
| 604 | + return response.json() |
| 605 | + elif response.status_code == 429: |
| 606 | + time.sleep(0.5 * (x + 1)) |
| 607 | + else: |
| 608 | + handle_api_error(response) |
| 609 | + else: |
| 610 | + handle_api_error(response) |
| 611 | + |
| 612 | + |
| 613 | +class Form1AApi: |
| 614 | + """ |
| 615 | + Base class for Form 1-A API |
| 616 | + https://sec-api.io/docs/reg-a-offering-statements-api#form-1-a-offering-statements-api |
| 617 | + """ |
| 618 | + |
| 619 | + def __init__(self, api_key, proxies=None): |
| 620 | + self.api_key = api_key |
| 621 | + self.api_endpoint = form_1A_endpoint + "?token=" + api_key |
| 622 | + self.proxies = proxies if proxies else {} |
| 623 | + |
| 624 | + def get_data(self, query): |
| 625 | + response = {} |
| 626 | + |
| 627 | + for x in range(3): |
| 628 | + response = requests.post( |
| 629 | + self.api_endpoint, json=query, proxies=self.proxies |
| 630 | + ) |
| 631 | + if response.status_code == 200: |
| 632 | + return response.json() |
| 633 | + elif response.status_code == 429: |
| 634 | + time.sleep(0.5 * (x + 1)) |
| 635 | + else: |
| 636 | + handle_api_error(response) |
| 637 | + else: |
| 638 | + handle_api_error(response) |
| 639 | + |
| 640 | + |
| 641 | +class Form1KApi: |
| 642 | + """ |
| 643 | + Base class for Form 1-K API |
| 644 | + https://sec-api.io/docs/reg-a-offering-statements-api#form-1-k-annual-reports-api |
| 645 | + """ |
| 646 | + |
| 647 | + def __init__(self, api_key, proxies=None): |
| 648 | + self.api_key = api_key |
| 649 | + self.api_endpoint = form_1K_endpoint + "?token=" + api_key |
| 650 | + self.proxies = proxies if proxies else {} |
| 651 | + |
| 652 | + def get_data(self, query): |
| 653 | + response = {} |
| 654 | + |
| 655 | + for x in range(3): |
| 656 | + response = requests.post( |
| 657 | + self.api_endpoint, json=query, proxies=self.proxies |
| 658 | + ) |
| 659 | + if response.status_code == 200: |
| 660 | + return response.json() |
| 661 | + elif response.status_code == 429: |
| 662 | + time.sleep(0.5 * (x + 1)) |
| 663 | + else: |
| 664 | + handle_api_error(response) |
| 665 | + else: |
| 666 | + handle_api_error(response) |
| 667 | + |
| 668 | + |
| 669 | +class Form1ZApi: |
| 670 | + """ |
| 671 | + Base class for Form 1-Z API |
| 672 | + https://sec-api.io/docs/reg-a-offering-statements-api#form-1-z-exit-reports-api |
| 673 | + """ |
| 674 | + |
| 675 | + def __init__(self, api_key, proxies=None): |
| 676 | + self.api_key = api_key |
| 677 | + self.api_endpoint = form_1Z_endpoint + "?token=" + api_key |
| 678 | + self.proxies = proxies if proxies else {} |
| 679 | + |
| 680 | + def get_data(self, query): |
| 681 | + response = {} |
| 682 | + |
| 683 | + for x in range(3): |
| 684 | + response = requests.post( |
| 685 | + self.api_endpoint, json=query, proxies=self.proxies |
| 686 | + ) |
| 687 | + if response.status_code == 200: |
| 688 | + return response.json() |
| 689 | + elif response.status_code == 429: |
| 690 | + time.sleep(0.5 * (x + 1)) |
| 691 | + else: |
| 692 | + handle_api_error(response) |
| 693 | + else: |
| 694 | + handle_api_error(response) |
| 695 | + |
| 696 | + |
581 | 697 | class FormAdvApi: |
582 | 698 | """ |
583 | 699 | Base class for Form ADV API |
|
0 commit comments