Skip to content
Snippets Groups Projects
Select Git revision
  • aac6d1d3cb6ab603ac90ef62253fe11ace92db8a
  • master default protected
  • feat/new-image-formats
  • clickable-select-chevron
  • 2.20.0
  • 2.19.0
  • 2.18.0
  • 2.17.0
  • 2.16.1
  • 2.16.0
  • 2.15.0
  • 2.14.0
  • 2.13.0
  • 2.12.1
  • 2.11.0
  • 2.10.0
  • 2.9.1
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.7.0
  • 2.6.0
  • 2.5.2
  • 2.5.1
24 results

04-text-input-addon.mustache

Blame
  • utils.py 711 B
    import logging
    import os.path
    
    import requests
    from django.conf import settings
    
    logger = logging.getLogger(__name__)
    
    
    def get_donated_amount_from_api(portal_project_id):
        url = os.path.join(
            settings.DONATE_PORTAL_API_URL, "donate/bar", str(portal_project_id)
        )
    
        try:
            response = requests.get(url, timeout=settings.DONATE_PORTAL_API_TIMEOUT)
            response.raise_for_status()
            _, amount = response.json()
            return amount
    
        except requests.exceptions.Timeout:
            logger.warning("Donate portal API call timed out for %s", url)
    
        except requests.exceptions.RequestException:
            logger.warning("Donate portal API call failed for %s", url)
    
        return None