Skip to content

Repository files navigation

helloasso-python

The HelloAsso Python library offers a straightforward way to interact with the HelloAsso API in Python applications. It features a collection of pre-built classes for API resources that automatically adapt to API responses, ensuring flexibility across different versions of the HelloAsso API.

Requirements.

Python 3.8+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install helloasso-python

(you may need to run pip with root permission: sudo pip install helloasso-python)

Then import the package:

importhelloasso_python

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

importhelloasso_python

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

importhelloasso_pythonfromhelloasso_python.restimportApiExceptionfrompprintimportpprint# Defining the host is optional and defaults to https://api.helloasso.com/v5# See configuration.py for a list of all supported configuration parameters.configuration=helloasso_python.Configuration(
host="https://api.helloasso.com/v5"
)
# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.configuration.access_token=os.environ["ACCESS_TOKEN"]
# Enter a context with an instance of the API clientwithhelloasso_python.ApiClient(configuration) asapi_client:
# Create an instance of the API classapi_instance=helloasso_python.AnnuaireApi(api_client)
page_size=20# int | The number of items per page (optional) (default to 20)continuation_token='continuation_token_example'# str | Continuation Token from which we wish to retrieve results (optional)hello_asso_api_v5_models_directory_list_forms_request=helloasso_python.HelloAssoApiV5ModelsDirectoryListFormsRequest() # HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply (optional)try:
# Récupérer les formulairesapi_response=api_instance.directory_forms_post(page_size=page_size, continuation_token=continuation_token, hello_asso_api_v5_models_directory_list_forms_request=hello_asso_api_v5_models_directory_list_forms_request)
print("The response of AnnuaireApi->directory_forms_post:\n")
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AnnuaireApi->directory_forms_post: %s\n"%e)

Documentation for API Endpoints

All URIs are relative to https://api.helloasso.com/v5

ClassMethodHTTP requestDescription
AnnuaireApidirectory_forms_postPOST /directory/formsRécupérer les formulaires
AnnuaireApidirectory_organizations_postPOST /directory/organizationsRécupérer les organisations
CheckoutApiorganizations_organization_slug_checkout_intents_checkout_intent_id_getGET /organizations/{organizationSlug}/checkout-intents/{checkoutIntentId}Récupérer une intention de paiement
CheckoutApiorganizations_organization_slug_checkout_intents_postPOST /organizations/{organizationSlug}/checkout-intentsInitialisation d'un Checkout
CommandesApiitems_item_id_getGET /items/{itemId}Obtenir le détail d'un article contenu dans une commande
CommandesApiorders_order_id_cancel_postPOST /orders/{orderId}/cancelAnnuler les paiements futurs pour une commande (pas de remboursement).
CommandesApiorders_order_id_getGET /orders/{orderId}Obtenir des informations détaillées sur une commande
CommandesApiorganizations_organization_slug_forms_form_type_form_slug_items_getGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/itemsObtenir une liste d'articles vendus dans un formulaire
CommandesApiorganizations_organization_slug_forms_form_type_form_slug_orders_getGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/ordersObtenir les commandes d'un formulaire
CommandesApiorganizations_organization_slug_items_getGET /organizations/{organizationSlug}/itemsObtenir une liste d'articles vendus par une organisation
CommandesApiorganizations_organization_slug_orders_getGET /organizations/{organizationSlug}/ordersObtenir les commandes d'une organisation
FormulairesApiorganizations_organization_slug_form_types_getGET /organizations/{organizationSlug}/formTypesObtenir une liste des types de formulaires pour une organisation
FormulairesApiorganizations_organization_slug_forms_form_type_action_quick_create_postPOST /organizations/{organizationSlug}/forms/{formType}/action/quick-createCréer un événement simplifié pour un organisme
FormulairesApiorganizations_organization_slug_forms_form_type_form_slug_public_getGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/publicObtenir des données publiques détaillées sur un formulaire
FormulairesApiorganizations_organization_slug_forms_getGET /organizations/{organizationSlug}/formsObtenir les formulaires d'une organisation
ListeDeValeursApivalues_company_legal_status_getGET /values/company-legal-statusObtenir la liste des statuts juridiques
ListeDeValeursApivalues_organization_categories_getGET /values/organization/categoriesObtenir la liste des catégories du JO
ListeDeValeursApivalues_tags_getGET /values/tagsObtenir la liste des tags publiques
OrganisationApiorganizations_legal_informations_legal_structures_getGET /organizations/legal-informations/legal-structuresObtenir la structure juridique d'une organisation visible.
OrganisationApiorganizations_legal_informations_organization_slug_configuration_getGET /organizations/legal-informations/{organizationSlug}/configurationObtenir la configuration des informations juridiques de l'organisation.
OrganisationApiorganizations_legal_informations_organization_slug_configuration_putPUT /organizations/legal-informations/{organizationSlug}/configurationMettre à jour la configuration des informations juridiques de l'organisation.
OrganisationApiorganizations_legal_informations_tax_information_texts_getGET /organizations/legal-informations/tax-information-textsObtenir les textes d'information fiscale de l'organisation.
OrganisationApiorganizations_organization_slug_getGET /organizations/{organizationSlug}Obtenir le détail d'une organisation
PaiementsApiorganizations_organization_slug_forms_form_type_form_slug_payments_getGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/paymentsObtenir les informations des paiements effectués sur un formulaire
PaiementsApiorganizations_organization_slug_payments_getGET /organizations/{organizationSlug}/paymentsObtenir les informations des paiements effectués sur une organisation
PaiementsApiorganizations_organization_slug_payments_search_getGET /organizations/{organizationSlug}/payments/searchRechercher des paiements.
PaiementsApipayments_payment_id_getGET /payments/{paymentId}Obtenir les informations détaillées d'un paiement.
PaiementsApipayments_payment_id_refund_postPOST /payments/{paymentId}/refundRembourser un paiement.
PartenairesApipartners_me_api_clients_putPUT /partners/me/api-clientsMise à jour du domaine
PartenairesApipartners_me_api_notifications_deleteDELETE /partners/me/api-notificationsSuppression de l'URL de notification principale
PartenairesApipartners_me_api_notifications_organizations_organization_slug_deleteDELETE /partners/me/api-notifications/organizations/{organizationSlug}Suppression d'une URL de notification liée à une organisation
PartenairesApipartners_me_api_notifications_organizations_organization_slug_putPUT /partners/me/api-notifications/organizations/{organizationSlug}Mise à jour d'une URL de notification liée à une organisation
PartenairesApipartners_me_api_notifications_putPUT /partners/me/api-notificationsMise à jour de l'URL de notification principale
PartenairesApipartners_me_getGET /partners/meRécupération des informations
PartenairesApipartners_me_organizations_getGET /partners/me/organizationsObtenir toutes les organisations
ReusFiscauxApiorganizations_organization_slug_tax_receipt_configuration_getGET /organizations/{organizationSlug}/tax-receipt/configurationObtenir la configuration des reçus fiscaux
ReusFiscauxApiorganizations_organization_slug_tax_receipt_configuration_putPUT /organizations/{organizationSlug}/tax-receipt/configurationMettre à jour la configuration des reçus fiscaux
ReusFiscauxApiorganizations_organization_slug_tax_receipt_fiscal_receipt_transmitter_putPUT /organizations/{organizationSlug}/tax-receipt/fiscal-receipt-transmitterMettre à jour l'émetteur des reçus fiscaux
ReusFiscauxApiorganizations_organization_slug_tax_receipt_preview_postPOST /organizations/{organizationSlug}/tax-receipt/previewPrévisualiser les reçus fiscaux
TagsApitags_tag_name_getGET /tags/{tagName}Obtenir le détail d'un tag interne
UtilisateursApiusers_me_organizations_getGET /users/me/organizationsObtenir mes organisations

Documentation For Models

Authorization

We use OAuth2 for authentication, so to avoid reinventing the wheel, we recommend using the Authlib package

Prerequisite

Install the Authlib package:

pip install requests
pip install Authlib

Client Credentials Flow

fromauthlib.integrations.requests_clientimportOAuth2Session# Configurationclient_id='your_client_id'client_secret='your_client_secret'token_url='https://api.helloasso.com/oauth2/token'# Create an OAuth2 sessionclient=OAuth2Session(client_id, client_secret)
# Get an access tokendefget_access_token():
token=client.fetch_token(token_url, grant_type='client_credentials')
print("Access Token:", token['access_token'])
print("Expires In:", token['expires_in'])
print("Refresh Token:", token['refresh_token'])
returntoken# Usageget_access_token()

Refresh Token Flow

fromauthlib.integrations.requests_clientimportOAuth2Session# Configurationclient_id='your_client_id'client_secret='your_client_secret'token_url='https://api.helloasso.com/oauth2/token'# Refresh the tokendefrefresh_access_token(refresh_token):
client=OAuth2Session(client_id, client_secret)
token=client.refresh_token(token_url, refresh_token=refresh_token)
print("New Access Token:", token['access_token'])
print("Expires In:", token['expires_in'])
print("New Refresh Token:", token['refresh_token'])
returntoken# Usagerefresh_access_token('your_refresh_token')

Authorization Code Flow

importbase64importhashlibimportosfromauthlib.integrations.requests_clientimportOAuth2Session# Configurationclient_id='your_client_id'client_secret='your_client_secret'authorize_url='https://auth.helloasso.com/authorize'token_url='https://api.helloasso.com/oauth2/token'redirect_uri='https://your-app.com/callback'# PKCE Helper Functionsdefgenerate_code_verifier():
"""Generate a high-entropy code_verifier."""returnbase64.urlsafe_b64encode(os.urandom(32)).rstrip(b'=').decode('utf-8')
defgenerate_code_challenge(code_verifier):
"""Generate a code_challenge based on the code_verifier."""code_challenge=hashlib.sha256(code_verifier.encode('utf-8')).digest()
returnbase64.urlsafe_b64encode(code_challenge).rstrip(b'=').decode('utf-8')
# Step 1: Generate the Authorization URLdefget_authorization_url():
# Generate PKCE parameterscode_verifier=generate_code_verifier()
code_challenge=generate_code_challenge(code_verifier)
client=OAuth2Session(client_id, client_secret, redirect_uri=redirect_uri)
authorization_url, state=client.create_authorization_url(authorize_url, code_challenge=code_challenge, code_challenge_method='S256')
print("Authorization URL: ", authorization_url)
print("Code verifier: ", code_verifier)
# Step 2: Exchange the authorization code for an access tokendefget_access_token_from_code(authorization_response, code_verifier):
client=OAuth2Session(client_id, client_secret, redirect_uri=redirect_uri)
token=client.fetch_token(token_url, authorization_response=authorization_response, code_verifier=code_verifier)
print("Access Token: ", token['access_token'])
print("Expires In: ", token['expires_in'])
print("Refresh Token: ", token['refresh_token'])
# Usageget_authorization_url()
# After user authorizes, exchange the code (passed in the redirect URL callback)#get_access_token_from_code('your_authorization_code', 'your_code_verifier')

About this package

This SDK is automatically generated by the OpenAPI Generator project:

  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

About

SDK python pour l'API HelloAsso

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages