Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
django-owm
is a reusable Django app for fetching and storing weather data from the OpenWeatherMap One Call 3.0 API. It provides a simple interface for managing weather locations, fetching current, historical, and forecast weather data, and displaying this information in your Django project.
pip install django-owm
'django_owm'
to your INSTALLED_APPS
setting:INSTALLED_APPS = [
...
'django_owm',
]
Add the following settings to your Django project's settings.py
file:
DJANGO_OWM = {
'OWM_API_KEY': 'your_openweathermap_api_key',
'OWM_API_RATE_LIMITS': {
'one_call': {
'calls_per_minute': 60,
'calls_per_month': 1000000,
},
},
'OWM_MODEL_MAPPINGS': {
'WeatherLocation': 'your_app.WeatherLocation',
'CurrentWeather': 'your_app.CurrentWeather',
'MinutelyWeather': 'your_app.MinutelyWeather',
'HourlyWeather': 'your_app.HourlyWeather',
'DailyWeather': 'your_app.DailyWeather',
'WeatherAlert': 'your_app.WeatherAlert',
'WeatherErrorLog': 'your_app.WeatherErrorLog',
'APICallLog': 'your_app.APICallLog',
},
'OWM_BASE_MODEL': models.Model,
'OWM_USE_BUILTIN_ADMIN': True,
'OWM_SHOW_MAP': False,
'OWM_USE_UUID': False,
}
Replace 'your_openweathermap_api_key'
with your actual OpenWeatherMap API key, and adjust the model mappings to point to your custom model implementations if you're not using the default models.
See the Usage Reference for more details.
Run migrations to create the necessary database tables:
python manage.py migrate
python manage.py create_location
python manage.py manual_weather_fetch
You can customize the models used by django-owm
by creating your own models that inherit from the abstract base models provided by the app. Update the OWM_MODEL_MAPPINGS
in your settings to use your custom models.
django-owm
provides basic views and templates for displaying weather information. You can override these templates by creating your own templates with the same names in your project's template directory.
To set up automated weather data fetching, configure Celery in your project and add the following task to your CELERYBEAT_SCHEDULE
:
CELERYBEAT_SCHEDULE = {
'fetch_weather_data': {
'task': 'django_owm.tasks.fetch_weather',
'schedule': crontab(minute='*/30'), # Run every 30 minutes
},
}
Please see the Usage Reference for further details.
Contributions are very welcome. To learn more, see the Contributor Guide.
Distributed under the terms of the MIT license, django-owm is free and open source software.
If you encounter any problems, please file an issue along with a detailed description.
This project was generated from @OmenApps's Cookiecutter Django Package template.
FAQs
Weather from the Open Weather Map APIs
We found that django-owm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.