Skip to content

v0.10.0

Latest
Compare
Choose a tag to compare
@konradsic konradsic released this 08 May 07:03
· 6 commits to master since this release

Version 0.10.0

This version is a pre-alpha release of this package meaning that the stable version will be released soon.

Before the stable release, two more version will be released: v1.0.0a (alpha) and v1.0.0b (beta)

What has been added?

  • This update focuses on bulk requests, so you can make a bulk request by calling Client.bulk_request function
  • BulkRequest class containing all data that will be requested
  • BulkResponse class containing fetched data from the API

How to make a bulk request?

Please note, that you need Pro+ plan or above to call a bulk request

  1. Build BulkRequest object
import weatherly

# method one
bulk = BulkRequest()
bulk.set_endpoint(weatherly.WeatherEndpoint.FORECAST)
bulk.add_query(("my-id", "London")) # note that it's a tuple
bulk.add_query(("second", "Berlin"))

# method two
bulk = BulkRequest.build(
    ("my-id", "London"), ("second", "Berlin"),
    endpoint=weatherly.WeatherEndpoint.FORECAST
)
  1. Call the client method
# variables:
# client - weatherly.Client with proper plan and API key
# bulk - bulk request object created before

bulk_resp = client.bulk_request(data=bulk, aqi=True) # enable AirQuality data

Congratulations! You have successfully called the bulk request function. Check the documentation for more informations