Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python packaging fails / PHP implementation desirable #29

Open
wq9578 opened this issue Aug 1, 2024 · 3 comments
Open

Python packaging fails / PHP implementation desirable #29

wq9578 opened this issue Aug 1, 2024 · 3 comments

Comments

@wq9578
Copy link

wq9578 commented Aug 1, 2024

On a current Mac, poetry installed via Homebrew fails:

$ poetry install

Command ['/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/bin/python3.12', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n    print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n    print(sys.base_prefix)\nelse:\n    print(sys.prefix)\n'] errored with the following return code -10

A PHP implementation would be desirable to obtain structured information (SI) as well as the current (AD) and chronological excerpt (CD) for a given legal entity.
With the Laravel framework, either Laravel's HTTP client powered by Guzzle might be used, or Laravel Dusk using a Selenium compatible driver if JavaScript is required. Unfortunately, this seems to be the case.

Both a request with curl (curl -d "registerArt_input=VR" -d "registerNummer=304" -d "registergericht_input=D2601" https://www.handelsregister.de/rp_web/erweitertesuche.xhtml) as well as a request with Laravel's HTTP client (obtaining the cookie in a first request, then reusing this cookie requesting the extended search form) fails with the error message "session expired".

Test using PHP Pest:

use Illuminate\Support\Facades\Http;

it('makes a request at handelsregister.de',
    closure: function () {
        $response = Http::get('https://www.handelsregister.de');

        // https://stackoverflow.com/a/70330475
        $cookie_value = $response->cookies->getCookieByName('JSESSIONID')->getValue();

        dump($cookie_value);

        // Advanced search
        $response = Http::withCookies(['JSESSIONID' => $cookie_value],
            'www.handelsregister.de')->get('https://www.handelsregister.de/rp_web/welcome.xhtml#');

        dump($response);
    });

It's a shame that the German federal services don't offer a proper API.
Also, a rate limit of 60 requests per hour is ridiculous for publicly available data.

@amacado
Copy link

amacado commented Oct 4, 2024

@wq9578 if you're interested, i have a working prototype implementation for the "api" using laravel dusk within laravel zero as a cli application to interact with the handelsregister website.

Arguments:
  language                                     Language which is used for interaction with `Handelsregister`. [default: "DE"]

Options:
      --state[=STATE]                          Select zero, one or more federal states to search in. If none are passed, the search will not be limited to a specific state. Valid codes are based on iso:code:3166:DE. (multiple values allowed)
      --keywords[=KEYWORDS]                    Search for company or keywords.
      --keywords-option[=KEYWORDS-OPTION]      Select an option how `keywords` are treated; One of (all|any|exact). [default: "any"]
      --keywords-match-similar                 If flag is set, similar matching keywords will be included in results.
      --subsidiary-office[=SUBSIDIARY-OFFICE]  Subsidiary / registered office.
      --include-deleted                        If flag is set, search results will also include deleted companies.
      --only-branches                          If flag is set, search only for branches in accordance with new law.
      --register-type[=REGISTER-TYPE]          Type of register (input value is language-dependent).
      --register-number[=REGISTER-NUMBER]      Company register number.
      --register-court[=REGISTER-COURT]        Register court (input value is language-dependent).
      --legal-status[=LEGAL-STATUS]            Company legal status (input value is language-dependent).
      --country[=COUNTRY]                      Country where the company is located (input value is language-dependent).
      --postal-code[=POSTAL-CODE]              Postal code where the company is located.
      --location[=LOCATION]                    Location/City where the company is located.
      --street[=STREET]                        Street where the company is located.
  -h, --help                                   Display help for the given command. When no command is given display help for the list command
  -q, --quiet                                  Do not output any message
  -V, --version                                Display this application version
      --ansi|--no-ansi                         Force (or disable --no-ansi) ANSI output
  -n, --no-interaction                         Do not ask any interactive question
      --env[=ENV]                              The environment the command should run under
  -v|vv|vvv, --verbose                         Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

@wq9578
Copy link
Author

wq9578 commented Oct 7, 2024

@amacado Yes, I'm interested! Where can I get it?

@amacado
Copy link

amacado commented Oct 7, 2024

@wq9578 sure, have a look here and feel free to contribute. It's in early implementation state and not yet fully functional: https://github.com/amacado/handelsregister-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants