a package to integrate foreca weather api with python client
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for foreca_api-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6ef9c18c7342bee94dae103acc984c0fefa089d447f60187bf9bc41625fcb6c |
|
MD5 | 0ac43aa26797110df5b2c02cab6b62d4 |
|
BLAKE2b-256 | 820667fe110017eebe93bfb3bd742ae942ffcfaa73a4abfee824317396bca949 |