Python Foreca Api Client
a simple module to integrate with foreca weather api service
Overview
Installation
This module is a pip package to let you integrate with foreca weather api service provider. in order to use this module you have to install it by pip command or through setup.
pip install foreca_api
Import package into your project by:
from foreca_api.api import ForecaAPI
in order to use the module please consider looking at examples and documentations.
Usage
Before starting to use this module you need to have an account for developers in foreca website, so please go inside the provided link and signup for 30 days free usage.
https://corporate.foreca.com/en/weather-api-freetrial
after signup just wait a few minute and you will get an email with 3 fields to use the service:
- User
- Password
- Administrative password
and also letting you know that you can use the developer api with the link below: https://developer.foreca.com/
in order to test the foreca api you can use postman or any other clients too but first of all you need to have an access_token which you can build through my module or you can do it yourself either way its fine. but remember you have an option to create an unlimited time access_token.
For easy implementations i have provided two simple examples, one for creating authenticating and getting access key and one for simple example to get current data from a location
# importing foreca module
from foreca_api.api import ForecaAPI
# creating an instance client
client = ForecaAPI()
# setting up username and password
client.set_user_pass(username='USERNAME', password='PASSWORD')
# trying to authenticate with provided credentials
client.authenticate()
# if everything is ok you get the access_token
access_token = client.get_access_token()
print(access_token)
now that you have access token with unlimited time access then there is no need for authenticating, you can just set the access_token and proceed with other requests.
#importing foreca module
from foreca_api.api import ForecaAPI
# creating an instance client
client = ForecaAPI()
# setting the access token for headers in client object
client.set_access_token(access_token="your access_token")
# set the location we need the data for
client.set_location(35.8439,50.9715)
# requesting to get result of that specific place
result = client.get_current_weather_location()
print(result)
References
Metadata
Release files for foreca-api 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| foreca_api-0.1.1.tar.gz | 4.1 kB | Without provenance | Details for foreca_api-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| foreca_api-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for foreca_api-0.1.1-py3-none-any.whl |
Total release size: 8.4 kB
Release files / foreca_api-0.1.1.tar.gz
| Download URL | foreca_api-0.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80c5c3667c9aa27796c3180d445591177e331d9fd80e97bb4e40aaa4d741b52e
|
|
BLAKE2b-256 checksum How to use checksums |
9ed65c8d62134e4823cbc36707c8f98a053e49b9e61ab4543d1403990ce2f7b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / foreca_api-0.1.1-py3-none-any.whl
| Download URL | foreca_api-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6ef9c18c7342bee94dae103acc984c0fefa089d447f60187bf9bc41625fcb6c
|
|
BLAKE2b-256 checksum How to use checksums |
820667fe110017eebe93bfb3bd742ae942ffcfaa73a4abfee824317396bca949
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Security for foreca-api 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.