Skip to content

Commit

Permalink
Merge branch 'release-1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Milind220 committed Mar 10, 2022
2 parents 426356f + e329e71 commit 84f0427
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Contributing to Ozon3
# Contributing to Ozone

:tada::+1: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to [Ozon3](https://github.com/Milind220/Ozone). These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
The following is a set of guidelines for contributing to [Ozone](https://github.com/Milind220/Ozone). These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

> **Note:** One very important thing is to make sure you only make PR's to the `dev` branch and not the `main` branch. The main branch is stable and should not be modified unless there's a new release.
Expand Down Expand Up @@ -30,7 +30,7 @@ The following is a set of guidelines for contributing to [Ozon3](https://github.
## What should I know before I get started?

### File Structure
Ozon3 is currently an extremely simple package.
Ozone is currently an extremely simple package.
* The package itself is in the ```src/ozone``` directory.
* [ozone.py](https://github.com/Milind220/Ozone/tree/main/src/ozone/ozone.py) contains the Ozone class that does most of the fetching of the data.
* [urls.py](https://github.com/Milind220/Ozone/tree/main/src/ozone/urls.py) contains a URLs class with the API endpoints and base urls.
Expand Down Expand Up @@ -61,7 +61,7 @@ Consider providing additional context by answering these questions:

* **Did the problem start happening recently** (e.g. after updating to a new version of Ozon3) or was this always a problem?
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
* **Which version of Ozon3 are you using?**
* **Which version of Ozon3 are youeusing?**

### Suggesting Enhancements or Features

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ozon3
version = 1.2.1
version = 1.2.2
author = Milind Sharma
author_email = [email protected]
description = A package to get air quality data using the WAQI API
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description="A package to get air quality data using the WAQI API",
license="GPLv3+",
url="https://github.com/Milind220/Ozone",
version="1.2.1",
version="1.2.2",
download_url="https://github.com/Milind220/Ozone/archive/refs/tags/v1.1.0.tar.gz",
packages=setuptools.find_packages(),
install_requires=[
Expand Down
31 changes: 29 additions & 2 deletions src/ozone/ozone.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
"""Ozone module for the Ozone package.
This module contains the main Ozone class, which is used for all live-data
collection done by the Ozone package.
This module should be used only as a part of the Ozone package, and should not
be run directly.
Attributes (module level):
CALLS (int=1000): The number of calls per second allowed by the WAQI API is 1000.
RATE_LIMIT (int=1): The time period in seconds for the max number of calls is 1 second.
"""

import pandas
import numpy
import requests
Expand All @@ -8,11 +21,20 @@
from typing import Any, Dict, List, Union, Tuple

# 1000 calls per second is the limit allowed by API
CALLS = 1000
RATE_LIMIT = 1
CALLS: int = 1000
RATE_LIMIT: int = 1


class Ozone:
"""Primary class for Ozone API
This class contains all the methods used for live data collection.
This class should be instantiated, and methods should be called from the
instance.
Attributes:
token (str): The private API token for the WAQI API service.
"""
_search_aqi_url: str = URLs.search_aqi_url
_find_stations_url: str = URLs.find_stations_url
_default_params: List[str] = [
Expand All @@ -32,6 +54,11 @@ class Ozone:
]

def __init__(self, token: str = ""):
"""Initialises the class instance and sets the API token value
Args:
token (str): The users private API token for the WAQI API.
"""
self.token: str = token
self._check_token_validity()

Expand Down
17 changes: 16 additions & 1 deletion src/ozone/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""urls module for the Ozone package.
This module contains the URLs dataclass for the package.
It should only be used with the Ozone package and not run directly.
"""

from dataclasses import dataclass


Expand All @@ -6,7 +13,15 @@
# endpoint urls stored here.
@dataclass(frozen=True)
class URLs:

"""Class that contains the endpoint urls for the WAQI API
This class should not be instantiated. It only contains class level attributes,
and no methods at all. It is a static dataclass.
Attributes:
search_aqi_url (str): The endpoint used for retrieving air quality data.
find_stations_url (str): The endpoint used for retrieving a collection of air quality measuring stations.
"""
# Base API endpoint.
_base_url: str = "https://api.waqi.info/"

Expand Down

0 comments on commit 84f0427

Please sign in to comment.