Name | abstract-api JSON |
Version |
1.0.0
JSON |
| download |
home_page | |
Summary | Python SDK for using AbstractAPI services |
upload_time | 2024-01-19 03:02:57 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2023 Ebram Shehata Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
sdk
abstract
api
abstract api
|
VCS |
 |
bugtrack_url |
|
requirements |
cachetools
certifi
cfgv
chardet
charset-normalizer
colorama
coverage
distlib
exceptiongroup
filelock
identify
idna
iniconfig
nodeenv
packaging
platformdirs
pluggy
pre-commit
pyproject-api
pytest
pytest-mock
PyYAML
requests
requests-mock
six
tomli
tox
urllib3
virtualenv
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# Abstract API Python SDK
[](https://abstractapi-python-sdk.readthedocs.io/en/latest/?badge=latest)
This is a simple and intuitive Python SDK for using [AbstractAPI's](https://www.abstractapi.com/) services.
Current supported services:
===========================
All AbstractAPI services are supported by this SDK (16th. January 2023).
- Email Validation
- Phone Validation
- VAT Validation/Calculation/Categories
- IBAN Validation
- IP Geolocation
- Holidays Lookup
- Exchange Rates Live/Convert/Historical
- Company Enrichment
- Timezone Current/Conversion
- Avatars Generation
- Website Screenshot
- Website Scrape
- Image Processing
Installation:
=============
Install using `pip`:
pip install abstract-api
Getting Started:
================
To use any service, you must have your API key for that service.\
To do that, you have two options:
1. Export your API key as an environment variable:\
To export an API key for a service, you should follow this scheme:
```
ABSTRACTAPI_{SERVICE_NAME}_API_KEY
```
Note: `SERVICE_NAME` is all uppercase and underscore separated.\
For example, to export your Email Validation service API key, use the following environment variable name:
```
ABSTRACTAPI_EMAIL_VALIDATION_API_KEY
```
Example in terminal:
```shell
export ABSTRACTAPI_AVATARS_API_KEY=612345e4a63044b47a1234567a53cc81
```
In initialization, you don't have to pass an API key:
```python
from abstract_api import EmailValidation
service = EmailValidation()
```
2. Pass your API key during service class instantiation:\
Example:
```python
from abstract_api import EmailValidation
service = EmailValidation(api_key="612345e4a63044b47a1234567a53cc81")
```
**Note**:
If both options were used simultaneously, the API key that was passed to constructor is used.
Examples:
=========
**Notes**:
- Each service response is represented as a response class to provide an intuitive\
Pythonic way for handling responses.
- All public interfaces of all services classes are modeled after AbstractAPI endpoints interfaces and responses.\
Example: Email Validation service endpoint expects the following parameters:
- `api_key`
- `email`
- `auto_correct`\
The `EmailValidation` class's `check()` method expects the same parameters `email` and `auto_correct`.\
(No need to pass `api_key`. It is already passed during service instantiation.)
**Recommended**:
- Check service class and service class response documentations.
- Response fields used in examples are not only the ones. Check documentation to see\
all the capabilities.
- Email Validation
```python
from abstract_api import EmailValidation
service = EmailValidation(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("example@example.com")
if response.is_valid_format:
print("Email is valid!")
if response.is_disposable_email:
print("Email is disposable, not this time :( ")
```
`EmailValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.email_validation.email_validation.html#abstract_api.email_validation.email_validation.EmailValidation)\
`EmailValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.email_validation.email_validation_response.html#abstract_api.email_validation.email_validation_response.EmailValidationResponse)
- Phone Validation
```python
from abstract_api import PhoneValidation
service = PhoneValidation(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("20123456789")
if response.valid:
print("Phone number is valid!")
```
`PhoneValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.phone_validation.phone_validation.html#abstract_api.phone_validation.phone_validation.PhoneValidation)\
`PhoneValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.phone_validation.phone_validation_response.html#abstract_api.phone_validation.phone_validation_response.PhoneValidationResponse)
- VAT Validation/Calculation/Inquiry
```python
from abstract_api import VAT
service = VAT(api_key="612345e4a63044b47a1234567a53cc81")
validation_response = service.check("SE556656688001")
calculation_response = service.calculate(amount=100, country_code="EG")
categories_response = service.categories("EG")
```
`VAT` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat.html#abstract_api.vat.vat.VAT)\
`VATValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_validation_response.html#abstract_api.vat.vat_validation_response.VATValidationResponse)\
`VATCalculationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_calculation_response.html#abstract_api.vat.vat_calculation_response.VATCalculationResponse)\
`VATCategoriesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_categories_response.html#abstract_api.vat.vat_categories_response.VATCategoriesResponse)
- IBAN Validation
```python
from abstract_api import IBANValidation
service = IBANValidation(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("BE71096123456769")
if response.is_valid:
print("IBAN is valid!")
```
`IBANValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.iban_validation.iban_validation.html#abstract_api.iban_validation.iban_validation.IBANValidation)\
`IBANValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.iban_validation.iban_validation_response.html#abstract_api.iban_validation.iban_validation_response.IBANValidationResponse)
- IP Geolocation
```python
from abstract_api import IPGeolocation
service = IPGeolocation(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("156.215.70.7", fields=["city"])
print("IP is in: ", response.city)
```
`IPGeolocation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.ip_geolocation.ip_geolocation.html#abstract_api.ip_geolocation.ip_geolocation.IPGeolocation)\
`IPGeolocationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.ip_geolocation.ip_geolocation_response.html#abstract_api.ip_geolocation.ip_geolocation_response.IPGeolocationResponse)
- Holidays Lookup
```python
from abstract_api import Holidays
service = Holidays(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("EG")
print(response.holidays)
```
`Holidays` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.holidays.holidays.html#abstract_api.holidays.holidays.Holidays)\
`HolidaysResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.holidays.holidays_response.html#abstract_api.holidays.holidays_response.HolidaysResponse)
- Exchange Rates Live/Convert/Historical
```python
from abstract_api import ExchangeRates
service = ExchangeRates(api_key="612345e4a63044b47a1234567a53cc81")
live_response = service.live("USD", "EGP")
conversion_response = service.convert("USD", "EGP", "2023-01-17", 150)
historical_response = service.historical("USD", "2023-01-17", 150)
```
`ExchangeRates` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.exchange_rates.html#abstract_api.exchange_rates.exchange_rates.ExchangeRates)\
`LiveExchangeRatesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.live_exchange_rates_response.html#abstract_api.exchange_rates.live_exchange_rates_response.LiveExchangeRatesResponse)\
`HistoricalExchangeRatesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.historical_exchange_rates_response.html#abstract_api.exchange_rates.historical_exchange_rates_response.HistoricalExchangeRatesResponse)\
`ExchangeRatesConversionResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.exchange_rates_conversion_response.html#abstract_api.exchange_rates.exchange_rates_conversion_response.ExchangeRatesConversionResponse)
- Company Enrichment
```python
from abstract_api import CompanyEnrichment
service = CompanyEnrichment(api_key="612345e4a63044b47a1234567a53cc81")
response = service.check("EG")
print(response.holidays)
```
`CompanyEnrichment` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.company_enrichment.company_enrichment.html#abstract_api.company_enrichment.company_enrichment.CompanyEnrichment)\
`CompanyEnrichmentResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.company_enrichment.company_enrichment_response.html#abstract_api.company_enrichment.company_enrichment_response.CompanyEnrichmentResponse)
- Timezone Current/Conversion
```python
from abstract_api import Timezone
service = Timezone(api_key="612345e4a63044b47a1234567a53cc81")
current_response = service.current("Cairo, Egypt", "82.111.111.111")
conversion_response = service.convert((30.0594627, 31.1758899), "Cairo, Egypt")
```
`Timezone` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.timezone.html#abstract_api.timezone.timezone.Timezone)\
`CurrentTimezoneResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.current_timezone_response.html#abstract_api.timezone.current_timezone_response.CurrentTimezoneResponse)\
`TimezoneConversionResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.timezone_conversion_response.html#abstract_api.timezone.timezone_conversion_response.TimezoneConversionResponse)
- Avatars Generation
```python
from abstract_api import Avatars
service = Avatars(api_key="612345e4a63044b47a1234567a53cc81")
response = service.create("John Doe", 200)
file = open("logo.png", "wb+")
file.write(response.content)
```
`Avatars` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.avatars.avatars.html#abstract_api.avatars.avatars.Avatars)\
`AvatarsResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.avatars.avatars_response.html#abstract_api.avatars.avatars_response.AvatarsResponse)
- Website Screenshot
```python
from abstract_api import WebsiteScreenshot
service = WebsiteScreenshot(api_key="612345e4a63044b47a1234567a53cc81")
response = service.capture("https://www.github.com", capture_full_page=False)
file = open("github-home-screenshot.png", "wb+")
file.write(response.content)
```
`WebsiteScreenshot` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.website_screenshot.website_screenshot.html#abstract_api.website_screenshot.website_screenshot.WebsiteScreenshot)\
`WebsiteScreenshotResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.website_screenshot.website_screenshot_response.html#abstract_api.website_screenshot.website_screenshot_response.WebsiteScreenshotResponse)
- Website Scrape
```python
from abstract_api import WebScraping
service = WebScraping(api_key="612345e4a63044b47a1234567a53cc81")
response = service.scrape("https://www.github.com", proxy_country="EG")
file = open("github-home-screenshot.png", "wb+")
file.write(response.content)
```
`WebScraping` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.web_scraping.web_scraping.html#abstract_api.web_scraping.web_scraping.WebScraping)\
`WebScrapingResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.web_scraping.web_scraping_response.html#abstract_api.web_scraping.web_scraping_response.WebScrapingResponse)
- Image Processing
```python
from abstract_api import ImageProcessing
from abstract_api.image_processing.strategies import Crop, Exact
resize = Exact(height=200, width=200)
service = ImageProcessing(api_key="612345e4a63044b47a1234567a53cc81")
image = open('example.png', 'rb')
response = service.upload(image, lossy=False, resize=resize)
print(response.url)
response = service.url("https://example.com/image.jpeg", lossy=False, resize=resize)
print(response.url)
```
`ImageProcessing` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.image_processing.image_processing.html#abstract_api.image_processing.image_processing.ImageProcessing)\
`ImageProcessingResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.image_processing.image_processing_response.html#abstract_api.image_processing.image_processing_response.ImageProcessingResponse)
### Handling Errors
1. If something wrong happened on client side:
```python
from abstract_api import ImageProcessing
from abstract_api.core.exceptions import ClientRequestError
service = ImageProcessing(api_key="612345e4a63044b47a1234567a53cc81")
try:
service.url("https://example.com/image.jpeg", quality=150)
except ClientRequestError as e:
print("Some error happended from client's side")
print(str(e))
'quality must be in range from 1 to 100 (inclusive)'
```
2. If the service endpoint returns a status code that is not 200 or 204.\
(200 and 204 are -currently- the only accepted status codes.)
```python
from abstract_api import ImageProcessing
from abstract_api.core.exceptions import APIRequestError
service = ImageProcessing(api_key="612345e4a63044b47a1234567a53cc81")
try:
service.url("https://example.com/image.jpeg", quality=150)
except APIRequestError as e:
if e.status_code == 500:
print("AbstractAPI service is currently having a problem")
print(str(e))
```
Raw data
{
"_id": null,
"home_page": "",
"name": "abstract-api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Ebram Shehata <ebram96@gmail.com>",
"keywords": "sdk,abstract,api,abstract api",
"author": "",
"author_email": "Ebram Shehata <ebram96@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9e/9a/f36c8687a3e7e9d2eb43483ba63d3a16bcd5ada8dac817c41679d3a5e1d3/abstract-api-1.0.0.tar.gz",
"platform": null,
"description": "# Abstract API Python SDK\n\n[](https://abstractapi-python-sdk.readthedocs.io/en/latest/?badge=latest)\n\nThis is a simple and intuitive Python SDK for using [AbstractAPI's](https://www.abstractapi.com/) services.\n\nCurrent supported services:\n===========================\nAll AbstractAPI services are supported by this SDK (16th. January 2023).\n- Email Validation\n- Phone Validation\n- VAT Validation/Calculation/Categories\n- IBAN Validation\n- IP Geolocation\n- Holidays Lookup\n- Exchange Rates Live/Convert/Historical\n- Company Enrichment\n- Timezone Current/Conversion\n- Avatars Generation\n- Website Screenshot\n- Website Scrape\n- Image Processing\n\nInstallation:\n=============\nInstall using `pip`:\n\n pip install abstract-api\n\nGetting Started:\n================\nTo use any service, you must have your API key for that service.\\\nTo do that, you have two options:\n1. Export your API key as an environment variable:\\\n To export an API key for a service, you should follow this scheme:\n ```\n ABSTRACTAPI_{SERVICE_NAME}_API_KEY\n ```\n Note: `SERVICE_NAME` is all uppercase and underscore separated.\\\n For example, to export your Email Validation service API key, use the following environment variable name:\n ```\n ABSTRACTAPI_EMAIL_VALIDATION_API_KEY\n ```\n Example in terminal:\n ```shell\n export ABSTRACTAPI_AVATARS_API_KEY=612345e4a63044b47a1234567a53cc81\n ```\n In initialization, you don't have to pass an API key:\n ```python\n from abstract_api import EmailValidation\n\n service = EmailValidation()\n ```\n2. Pass your API key during service class instantiation:\\\n Example:\n ```python\n from abstract_api import EmailValidation\n\n service = EmailValidation(api_key=\"612345e4a63044b47a1234567a53cc81\")\n ```\n\n**Note**:\nIf both options were used simultaneously, the API key that was passed to constructor is used.\n\nExamples:\n=========\n**Notes**:\n- Each service response is represented as a response class to provide an intuitive\\\nPythonic way for handling responses.\n- All public interfaces of all services classes are modeled after AbstractAPI endpoints interfaces and responses.\\\n Example: Email Validation service endpoint expects the following parameters:\n - `api_key`\n - `email`\n - `auto_correct`\\\n The `EmailValidation` class's `check()` method expects the same parameters `email` and `auto_correct`.\\\n (No need to pass `api_key`. It is already passed during service instantiation.)\n\n**Recommended**:\n- Check service class and service class response documentations.\n- Response fields used in examples are not only the ones. Check documentation to see\\\n all the capabilities.\n\n- Email Validation\n ```python\n from abstract_api import EmailValidation\n service = EmailValidation(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"example@example.com\")\n if response.is_valid_format:\n print(\"Email is valid!\")\n if response.is_disposable_email:\n print(\"Email is disposable, not this time :( \")\n ```\n `EmailValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.email_validation.email_validation.html#abstract_api.email_validation.email_validation.EmailValidation)\\\n `EmailValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.email_validation.email_validation_response.html#abstract_api.email_validation.email_validation_response.EmailValidationResponse)\n\n- Phone Validation\n ```python\n from abstract_api import PhoneValidation\n service = PhoneValidation(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"20123456789\")\n if response.valid:\n print(\"Phone number is valid!\")\n ```\n `PhoneValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.phone_validation.phone_validation.html#abstract_api.phone_validation.phone_validation.PhoneValidation)\\\n `PhoneValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.phone_validation.phone_validation_response.html#abstract_api.phone_validation.phone_validation_response.PhoneValidationResponse)\n\n- VAT Validation/Calculation/Inquiry\n ```python\n from abstract_api import VAT\n service = VAT(api_key=\"612345e4a63044b47a1234567a53cc81\")\n validation_response = service.check(\"SE556656688001\")\n calculation_response = service.calculate(amount=100, country_code=\"EG\")\n categories_response = service.categories(\"EG\")\n ```\n `VAT` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat.html#abstract_api.vat.vat.VAT)\\\n `VATValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_validation_response.html#abstract_api.vat.vat_validation_response.VATValidationResponse)\\\n `VATCalculationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_calculation_response.html#abstract_api.vat.vat_calculation_response.VATCalculationResponse)\\\n `VATCategoriesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.vat.vat_categories_response.html#abstract_api.vat.vat_categories_response.VATCategoriesResponse)\n\n- IBAN Validation\n ```python\n from abstract_api import IBANValidation\n service = IBANValidation(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"BE71096123456769\")\n if response.is_valid:\n print(\"IBAN is valid!\")\n ```\n `IBANValidation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.iban_validation.iban_validation.html#abstract_api.iban_validation.iban_validation.IBANValidation)\\\n `IBANValidationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.iban_validation.iban_validation_response.html#abstract_api.iban_validation.iban_validation_response.IBANValidationResponse)\n\n- IP Geolocation\n ```python\n from abstract_api import IPGeolocation\n service = IPGeolocation(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"156.215.70.7\", fields=[\"city\"])\n print(\"IP is in: \", response.city)\n ```\n `IPGeolocation` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.ip_geolocation.ip_geolocation.html#abstract_api.ip_geolocation.ip_geolocation.IPGeolocation)\\\n `IPGeolocationResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.ip_geolocation.ip_geolocation_response.html#abstract_api.ip_geolocation.ip_geolocation_response.IPGeolocationResponse)\n\n- Holidays Lookup\n ```python\n from abstract_api import Holidays\n service = Holidays(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"EG\")\n print(response.holidays)\n ```\n `Holidays` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.holidays.holidays.html#abstract_api.holidays.holidays.Holidays)\\\n `HolidaysResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.holidays.holidays_response.html#abstract_api.holidays.holidays_response.HolidaysResponse)\n\n- Exchange Rates Live/Convert/Historical\n ```python\n from abstract_api import ExchangeRates\n service = ExchangeRates(api_key=\"612345e4a63044b47a1234567a53cc81\")\n live_response = service.live(\"USD\", \"EGP\")\n conversion_response = service.convert(\"USD\", \"EGP\", \"2023-01-17\", 150)\n historical_response = service.historical(\"USD\", \"2023-01-17\", 150)\n ```\n `ExchangeRates` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.exchange_rates.html#abstract_api.exchange_rates.exchange_rates.ExchangeRates)\\\n `LiveExchangeRatesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.live_exchange_rates_response.html#abstract_api.exchange_rates.live_exchange_rates_response.LiveExchangeRatesResponse)\\\n `HistoricalExchangeRatesResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.historical_exchange_rates_response.html#abstract_api.exchange_rates.historical_exchange_rates_response.HistoricalExchangeRatesResponse)\\\n `ExchangeRatesConversionResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.exchange_rates.exchange_rates_conversion_response.html#abstract_api.exchange_rates.exchange_rates_conversion_response.ExchangeRatesConversionResponse)\n\n- Company Enrichment\n ```python\n from abstract_api import CompanyEnrichment\n service = CompanyEnrichment(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.check(\"EG\")\n print(response.holidays)\n ```\n `CompanyEnrichment` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.company_enrichment.company_enrichment.html#abstract_api.company_enrichment.company_enrichment.CompanyEnrichment)\\\n `CompanyEnrichmentResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.company_enrichment.company_enrichment_response.html#abstract_api.company_enrichment.company_enrichment_response.CompanyEnrichmentResponse)\n\n- Timezone Current/Conversion\n ```python\n from abstract_api import Timezone\n service = Timezone(api_key=\"612345e4a63044b47a1234567a53cc81\")\n current_response = service.current(\"Cairo, Egypt\", \"82.111.111.111\")\n conversion_response = service.convert((30.0594627, 31.1758899), \"Cairo, Egypt\")\n ```\n `Timezone` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.timezone.html#abstract_api.timezone.timezone.Timezone)\\\n `CurrentTimezoneResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.current_timezone_response.html#abstract_api.timezone.current_timezone_response.CurrentTimezoneResponse)\\\n `TimezoneConversionResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.timezone.timezone_conversion_response.html#abstract_api.timezone.timezone_conversion_response.TimezoneConversionResponse)\n\n- Avatars Generation\n ```python\n from abstract_api import Avatars\n service = Avatars(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.create(\"John Doe\", 200)\n file = open(\"logo.png\", \"wb+\")\n file.write(response.content)\n ```\n `Avatars` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.avatars.avatars.html#abstract_api.avatars.avatars.Avatars)\\\n `AvatarsResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.avatars.avatars_response.html#abstract_api.avatars.avatars_response.AvatarsResponse)\n\n- Website Screenshot\n ```python\n from abstract_api import WebsiteScreenshot\n service = WebsiteScreenshot(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.capture(\"https://www.github.com\", capture_full_page=False)\n file = open(\"github-home-screenshot.png\", \"wb+\")\n file.write(response.content)\n ```\n `WebsiteScreenshot` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.website_screenshot.website_screenshot.html#abstract_api.website_screenshot.website_screenshot.WebsiteScreenshot)\\\n `WebsiteScreenshotResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.website_screenshot.website_screenshot_response.html#abstract_api.website_screenshot.website_screenshot_response.WebsiteScreenshotResponse)\n\n- Website Scrape\n ```python\n from abstract_api import WebScraping\n service = WebScraping(api_key=\"612345e4a63044b47a1234567a53cc81\")\n response = service.scrape(\"https://www.github.com\", proxy_country=\"EG\")\n file = open(\"github-home-screenshot.png\", \"wb+\")\n file.write(response.content)\n ```\n `WebScraping` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.web_scraping.web_scraping.html#abstract_api.web_scraping.web_scraping.WebScraping)\\\n `WebScrapingResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.web_scraping.web_scraping_response.html#abstract_api.web_scraping.web_scraping_response.WebScrapingResponse)\n\n- Image Processing\n ```python\n from abstract_api import ImageProcessing\n from abstract_api.image_processing.strategies import Crop, Exact\n resize = Exact(height=200, width=200)\n service = ImageProcessing(api_key=\"612345e4a63044b47a1234567a53cc81\")\n image = open('example.png', 'rb')\n response = service.upload(image, lossy=False, resize=resize)\n print(response.url)\n response = service.url(\"https://example.com/image.jpeg\", lossy=False, resize=resize)\n print(response.url)\n ```\n `ImageProcessing` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.image_processing.image_processing.html#abstract_api.image_processing.image_processing.ImageProcessing)\\\n `ImageProcessingResponse` documentation can be found [here](https://abstractapi-python-sdk.readthedocs.io/en/latest/api_reference/abstract_api.image_processing.image_processing_response.html#abstract_api.image_processing.image_processing_response.ImageProcessingResponse)\n\n### Handling Errors\n1. If something wrong happened on client side:\n ```python\n from abstract_api import ImageProcessing\n from abstract_api.core.exceptions import ClientRequestError\n service = ImageProcessing(api_key=\"612345e4a63044b47a1234567a53cc81\")\n try:\n service.url(\"https://example.com/image.jpeg\", quality=150)\n except ClientRequestError as e:\n print(\"Some error happended from client's side\")\n print(str(e))\n 'quality must be in range from 1 to 100 (inclusive)'\n ```\n2. If the service endpoint returns a status code that is not 200 or 204.\\\n (200 and 204 are -currently- the only accepted status codes.)\n ```python\n from abstract_api import ImageProcessing\n from abstract_api.core.exceptions import APIRequestError\n service = ImageProcessing(api_key=\"612345e4a63044b47a1234567a53cc81\")\n try:\n service.url(\"https://example.com/image.jpeg\", quality=150)\n except APIRequestError as e:\n if e.status_code == 500:\n print(\"AbstractAPI service is currently having a problem\")\n print(str(e))\n ```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Ebram Shehata Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Python SDK for using AbstractAPI services",
"version": "1.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/ebram96/AbstractAPI-Python-SDK/issues",
"Homepage": "https://github.com/ebram96/AbstractAPI-Python-SDK",
"Repository": "https://github.com/ebram96/AbstractAPI-Python-SDK.git"
},
"split_keywords": [
"sdk",
"abstract",
"api",
"abstract api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3364b51dcc4d0118f8fa96bed569031b1513d63616d697bb0a4b29d9af814b50",
"md5": "6ec8f538af17c33bf738505b9a2f3f28",
"sha256": "3a9cba04dbb605275bf1667f259f8a03a5540a832db3947d77442bc36064a3dc"
},
"downloads": -1,
"filename": "abstract_api-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ec8f538af17c33bf738505b9a2f3f28",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 67562,
"upload_time": "2024-01-19T03:02:55",
"upload_time_iso_8601": "2024-01-19T03:02:55.880532Z",
"url": "https://files.pythonhosted.org/packages/33/64/b51dcc4d0118f8fa96bed569031b1513d63616d697bb0a4b29d9af814b50/abstract_api-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e9af36c8687a3e7e9d2eb43483ba63d3a16bcd5ada8dac817c41679d3a5e1d3",
"md5": "983aae47feebffb0588d5888f59b931b",
"sha256": "a121f389a7142e19beb052b29ba5f373c088b3da0ed51cbf4ea42182a3b67205"
},
"downloads": -1,
"filename": "abstract-api-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "983aae47feebffb0588d5888f59b931b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 38712,
"upload_time": "2024-01-19T03:02:57",
"upload_time_iso_8601": "2024-01-19T03:02:57.789985Z",
"url": "https://files.pythonhosted.org/packages/9e/9a/f36c8687a3e7e9d2eb43483ba63d3a16bcd5ada8dac817c41679d3a5e1d3/abstract-api-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-19 03:02:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ebram96",
"github_project": "AbstractAPI-Python-SDK",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "cachetools",
"specs": [
[
"==",
"5.3.2"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2023.11.17"
]
]
},
{
"name": "cfgv",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "chardet",
"specs": [
[
"==",
"5.2.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "coverage",
"specs": [
[
"==",
"7.4.0"
]
]
},
{
"name": "distlib",
"specs": [
[
"==",
"0.3.8"
]
]
},
{
"name": "exceptiongroup",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.13.1"
]
]
},
{
"name": "identify",
"specs": [
[
"==",
"2.5.33"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.6"
]
]
},
{
"name": "iniconfig",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "nodeenv",
"specs": [
[
"==",
"1.8.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"23.2"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.1.0"
]
]
},
{
"name": "pluggy",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "pre-commit",
"specs": [
[
"==",
"3.6.0"
]
]
},
{
"name": "pyproject-api",
"specs": [
[
"==",
"1.6.1"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.4.4"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
"==",
"3.12.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "requests-mock",
"specs": [
[
"==",
"1.11.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "tomli",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "tox",
"specs": [
[
"==",
"4.12.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "virtualenv",
"specs": [
[
"==",
"20.25.0"
]
]
}
],
"tox": true,
"lcname": "abstract-api"
}