A library to simplify the access to the REST API of similarweb.
Project description
similarweb REST API
Introduction
The similarweb REST API is a library that simplifies the access to the REST API of Similarweb.
Installation
To install the library, run the following command:
Copy code
pip install similarweb-rest-api
Usage
To use the library, import the SimilarwebApi class and create an instance of it. Then, use the get method to make a request to the API.
from similarweb_rest_api import SimilarwebApi
api = SimilarwebApi()
response = api.get('website/traffic', domain='example.com', start_date='2020-01-01', end_date='2020-01-31')
The get method returns a SimilarwebResponse object, which contains the API response in various formats. To access the response in a specific format, use one of the following methods:
to_json: returns the response as a JSON string to_dataframe: returns the response as a Pandas DataFrame to_sql: returns an SQL statement to insert the response into a table to_xml: returns the response as an XML document to_excel: writes the response to an Excel file to_csv: writes the response to a CSV file to_html: returns the response as an HTML table to_jsonl: writes the response to a JSON Lines file to_yaml: returns the response as a YAML document
For example, to convert the response to a DataFrame and display the first 5 rows:
df = response.to_dataframe()
df.head()
Parameters
The following parameters can be passed to the get function:
name: The name of the API endpoint. domain: The domain to get data for. api_key: Your API key. start_date: The start date for the data range (in the format YYYY-MM). end_date: The end date for the data range (in the format YYYY-MM).
License
This library is free to use for non-commercial purposes. For commercial use, please contact the author for permission.
Contact
If you have any questions or suggestions, please contact the author Damien Frigewski at dfrigewski@gmail.com.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for similarweb_rest_api-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b202ac118ce1d74baf05f0fabf4e8a4cfde93351f2489f6dae2545ff496a246 |
|
MD5 | 3523da6ceebf7283fbc5808fdfb2a5ee |
|
BLAKE2b-256 | bcd898062e5c5ef4c75c6bd32c900cdcb83baacc81c18b3cbafbda238e4d3922 |
Hashes for similarweb_rest_api-0.0.4-py3.11.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 529c71cdabb4b9cfada24a17b01907018c8db6f1373deb0dfce2fa80dc2ea861 |
|
MD5 | daef285a34924755425c5718fe8fd6fe |
|
BLAKE2b-256 | 3ef37d94f161c4a626920d25aa31f1658b0968bdb45ba6e12fefb46e6837c1f3 |
Hashes for similarweb_rest_api-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ffe62f4e5e3cb0c11b6dd18370e72a9d324c0db6c1736d52ad1e1c2034e65e7 |
|
MD5 | c8b7b22e8f650a336eb6dc1787655258 |
|
BLAKE2b-256 | bec9e957e380f6a15669c6aebfd56df0f7216f8f13426bb7f24000b3ff304b18 |