Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 32 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<br />
<div align="center">
<a href="https://magicalapi.com">
<img src="https://raw.githubusercontent.com/magicalapi/magicalapi-python/master/docs/logo.jpg?raw=true" alt="Logo" width="80" height="80">
<img src="https://raw.githubusercontent.com/magicalapi/magicalapi-python/master/docs/logo.png?raw=true" alt="Logo" width="80" height="80">
</a>

<h3 align="center">MagicalAPI Python Client</h3>
Expand All @@ -34,8 +34,8 @@
<!-- <a href="https://github.com/magicalapi/magicalapi-python"><strong>Explore the docs »</strong></a> -->
<!-- <br /> -->
<!-- <br /> -->
<a href="https://github.com/magicalapi/magicalapi-python">View Demo</a>
·
<!-- <a href="https://github.com/magicalapi/magicalapi-python">View Demo</a> -->
<!-- · -->
<a href="https://github.com/magicalapi/magicalapi-python/issues">Report Bug</a>
·
<a href="https://github.com/magicalapi/magicalapi-python/issues">Request Feature</a>
Expand Down Expand Up @@ -75,7 +75,7 @@

## What is [MagicalAPI][website-url]?

MagicalAPI is your AI edge in **content** and **careers**, Your ultimate tool for **YouTube SEO**, **Resume Parsing**, **LinkedIn data** and more.
MagicalAPI is your AI edge in **content** and **careers**, Your ultimate tool for **Resume Parsing**, **LinkedIn data** and more.

<br>

Expand Down Expand Up @@ -149,44 +149,43 @@ client = AsyncClinet()

<br>

Here is an example of how to get keywords of [Youtube Top Keywords](https://magicalapi.com/services/youtube-keywords) service:
Here is an example of how to parse a resume using [Resume Parser](https://magicalapi.com/resume/) service:

```python
import asyncio

from magicalapi.client import AsyncClient
from magicalapi.errors import APIServerError, APIServerTimedout
from magicalapi.types.base import ErrorResponse

search_sentence = "chatgpt 4 turbo" # your search sentence to get keywords related to
country = "1" # use get_countries method to see countries codes (Default = 1 : WorlWide)
language = "1000" # use get_languages method to see countries codes (Default = 1000 : English)
resume_url = (
"https://resume-resource.com/wp-content/uploads/00123-sales-professional-resume.pdf"
)
output_file_name = "resume_parser.json"


async def main():
# the api_key will load from the .env file
async with AsyncClient() as client:
# Get YouTube keywords
keywords_response = await client.youtube_top_keywords.get_keywords(
search_sentence=search_sentence,
country=country,
language=language,
)
if type(keywords_response) == ErrorResponse:
# got error from API
print("Error :", keywords_response.message)
else:
# got response successfully
print("credits :", keywords_response.usage.credits)
print("keywords count :", len(keywords_response.data.keywords))

# save response in JSON file
with open("keywords_response.json", "w") as file:
file.write(keywords_response.model_dump_json(indent=3))


# get languages list
# languages = await client.youtube_top_keywords.get_languages()
# get countries list
# countries = await client.youtube_top_keywords.get_countries()
try:
# the api_key will load from the .env file
async with AsyncClient() as client:
response = await client.resume_parser.get_resume_parser(url=resume_url)

if isinstance(response, ErrorResponse):
# got error from api
print("Error :", response.message)
else:
# got response successfully
print("credists :", response.usage.credits)
# save response in json file
with open(output_file_name, "w") as file:
file.write(response.model_dump_json(indent=3))

print(f"response saved to {output_file_name}")
except (APIServerError, APIServerTimedout) as e:
# handling server errors
print(e)
except Exception as e:
print("An error occurred:", str(e))


asyncio.run(main())
Expand Down
Binary file removed docs/logo.jpg
Binary file not shown.
Binary file modified docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 0 additions & 35 deletions examples/youtube_seo.py

This file was deleted.

41 changes: 0 additions & 41 deletions examples/youtube_suggestions.py

This file was deleted.

51 changes: 0 additions & 51 deletions examples/youtube_top_keywords.py

This file was deleted.

10 changes: 0 additions & 10 deletions magicalapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
ProfileDataService,
ResumeParserService,
ResumeScoreService,
YoutubeSeoService,
YoutubeSuggestionsService,
YoutubeTopKeywordsService,
)
from magicalapi.services.resume_review_service import ResumeReviewService
from magicalapi.settings import settings
Expand Down Expand Up @@ -58,18 +55,11 @@ def __init__(self, api_key: str | None = None) -> None:
logger.debug("httpx client created")

# create service
self.youtube_top_keywords = YoutubeTopKeywordsService(
httpx_client=self._httpx_client
)
self.profile_data = ProfileDataService(httpx_client=self._httpx_client)
self.company_data = CompanyDataService(httpx_client=self._httpx_client)
self.youtube_seo = YoutubeSeoService(httpx_client=self._httpx_client)
self.resume_parser = ResumeParserService(httpx_client=self._httpx_client)
self.resume_score = ResumeScoreService(httpx_client=self._httpx_client)
self.resume_review = ResumeReviewService(httpx_client=self._httpx_client)
self.youtube_suggestions = YoutubeSuggestionsService(
httpx_client=self._httpx_client
)

logger.debug(f"async client created : {self}")

Expand Down
6 changes: 0 additions & 6 deletions magicalapi/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
from .resume_parser_service import ResumeParserService
from .resume_review_service import ResumeReviewService
from .resume_score_service import ResumeScoreService
from .youtube_seo_service import YoutubeSeoService
from .youtube_suggestions_service import YoutubeSuggestionsService
from .youtube_top_keywords_service import YoutubeTopKeywordsService

__all__ = [
"YoutubeTopKeywordsService",
"ProfileDataService",
"CompanyDataService",
"YoutubeSeoService",
"ResumeParserService",
"ResumeScoreService",
"ResumeReviewService",
"YoutubeSuggestionsService",
]
36 changes: 0 additions & 36 deletions magicalapi/services/youtube_seo_service.py

This file was deleted.

53 changes: 0 additions & 53 deletions magicalapi/services/youtube_suggestions_service.py

This file was deleted.

Loading
Loading