Package: python-hostingde
Hosting.de Client-LibraryAn unofficial client library for thehosting.de API.API Version: v1RequirementsThe package requires Python 3.6+. It is currently only tested with Python 3.8, but should work for Python 3.6.Installation & UsageInstall with pip:pipinstallpython-hostingdeGetting StartedPlease follow theinstallation procedure.  To login with the client, you need your endpoint
url, and an API token. To authenticate:fromhostingdeimportapifromhostingde.clientimportHostingDeClientclient:HostingDeClient=api.login('<your endpoint url>','<your token>')Your endpoint should look like this:https://<your_domain>/api(do not forget the/apiwhile providing the endpoint).The client is modularized into the different service types, for exampleclient.dnsrefers to the DNS service API.For example, to fetch all zones, you can use:fromhostingdeimportapifromhostingde.clientimportHostingDeClientclient:HostingDeClient=api.login('<your endpoint url>','<your token>')forzoneinclient.dns.list_zones():print(zone)All implemented endpoints are fully documented and typed. You will get corresponding hints in your IDE of choice.Filtering and Sorting APIIn order to use filter and sort APIs, we simplified the usage of the API. For example, to search for a specific zone:fromhostingdeimportapifromhostingde.clientimportHostingDeClientfromhostingde.model.filterimportFilterConditionclient:HostingDeClient=api.login('<your endpoint url>','<your token>')zone_filter=FilterCondition('zoneName').eq('example.com')forzoneinclient.dns.list_zones(filter=zone_filter):print(zone)This will automatically build the corresponding filter expression in the background{"field":"domainName","value":"example.com","relation":"equal"}Apart fromFilterCondition.eq, the condition supports all relations currently defined in the API:RelationOperationDescriptionequalFilterCondition.eqfieldmust match value exactlyunequalFilterCondition.nefieldmust not be the same as valuegreaterFilterCondition.gtfieldmust be greater than value. This might apply to e.g. an integer value, a date or a date timelessFilterCondition.ltfieldmust be less than value. This might apply to e.g. an integer value, a date or a date timegreaterEqualFilterCondition.gefieldmust be greater than or equal to value. This might apply to e.g. an integer value, a date or a date timelessEqualFilterCondition.lefieldmust be less than or equal to value. This might apply to e.g. an integer value, a date or a date timeFilterCondition.startswithCorresponds to thefieldmethod. However, uses wildcard to simplify the usage -->field*Chaining filters is easily supported as well:fromhostingdeimportapifromhostingde.clientimportHostingDeClientfromhostingde.model.filterimportFilterConditionclient:HostingDeClient=api.login('<your endpoint url>','<your token>')zone_filter=(FilterCondition('zoneName').startswith('example')|FilterCondition('zoneName').startswith('demo'))&FilterCondition('zoneName').ne('*.com')forzoneinclient.dns.list_zones(filter=zone_filter):print(zone)This automatically builds the equivalent filter expression for the API:{"subFilterConnective":"AND","subFilter":[{"subFilterConnective":"OR","subFilter":[{"field":"zoneName","value":"example*","relation":"equal"},{"field":"zoneName","value":"demo*","relation":"equal"}]},{"field":"zoneName","value":"*.com","relation":"unequal"}]}which is less verbose and more readable.Error HandlingIf the request returns an error, the error is wrapped inside aapi.client.exceptions.APIExceptionwith all
details included. You can easily catch them and react to them accordingly.Current statusCurrently, we support the following endpoints for the following services:DNSlist_zones 100%list_zone_configs 100%list_records 100%delete_zone 100%jobs_find 50% - missing official documentation, functionality cannot be guaranteedupdate_zone 100%get_default_nameserver 100%Domainlist_domains 100%register_domain 100%jobs_find 100%list_contacts 100%create_contact 0%update_contact 0%Accountlist_accounts 50% - missing official documentation, functionality cannot be guaranteedget_own_account 50% - missing official documentation, functionality only implemented as far as requiredWe plan to add more endpoints in the future, for example for SSL and Domain services.The implemented endpoints do not contain any logic to catch asynchronous behaviour yet. We plan to add async: boolproperty to the corresponding endpoints in the future as soon as the jobs API is properly defined.DevelopingMake sure that you satisfy therequirements. Checkout the project, then runpipinstall-rrequirements.txtpipinstall-rrequirements-test.txtpreferably in a virtual environment.This will install all dependencies for the main project, as well as the dependencies used for testing.TestingRunpytest-vv--cov-reportterm-missing:skip-covered--cov=api--cov=utils--cov-reportxml--html=test-results/report.html--cov-reporthtml:test-results/covin order to test the code.ContributingYou can contribute to the project and add new endpoints that you need. However, in order to merge, we require:All implemented methodsMUSTbe documented using reStructuredText notation.All implemented methodsMUSTbe typed properlyWe require a test coverage of at least 90%, and your additions must not decrease the overall coverage of the codebase.We appreciate if you usethiscommit message format.