Skip to main content

Wrappers for some common SERP ingestion APIs we use at TK

Project description

TK APIs

This is a collection of the wrapper functions used to call various third-party, SERP-related data sources. The implementation returns things as Pandas DataFrames, because this package was written by a data scientist for data science use.

Code examples

The package contains modules for each of the APIs. You'll need to provide your own API keys; an easy way to do this is a .env file.

My examples below assume you have defined a .env and use the python-dotenv package to load in this information:

from dotenv import load_dotenv
import os

load_dotenv()

Once the credentials are in, you can load the desired module(s) and execute queries accordingly:

Moz

Note: All values of params must be lists. Strings are not accepted.

from tk_apis import moz_calls as moz

moz.get_url_data(url='https://www.terakeet.com',
                 api_key=os.environ['MOZ_AUTH'],
                 params='monthly_history_deltas': ['domain_authority'],
                 'daily_history_deltas': ['domain_authority'])

SemRush

from tk_apis import semrush_calls as sr

sr.get_related_keywords(keyword='babylonian empire', 
                        api_key=os.environ['SEMRUSH_KEY'])
sr.get_top_related_keyword(keyword='babylonian empire', 
                           api_key=os.environ['SEMRUSH_KEY'])

sr.get_keyword_data(keyword='babylonian empire', 
                    api_key=os.environ['SEMRUSH_KEY'])
sr.get_search_volume(keyword='sumerians', 
                     api_key=os.environ['SEMRUSH_KEY'])

sr.get_organic_results(keyword='babylonian empire',
                       api_key=os.environ['SEMRUSH_KEY'],
                       n=10)

sr.get_url_organic_kws(u='https://www.nordstrom.com',
                       api_key=os.environ['SEMRUSH_KEY'])

SerpApi

from tk_apis import serpapi_calls as sa

serp = sa.get_serp_result(keyword='arnold schwarzenegger', 
                          api_key=os.environ['SERPAPI_KEY'])

sa.extract_organic_df(result_set=serp)
sa.extract_knowledge_graph(result_set=serp)
sa.extract_top_stories(result_set=serp)
sa.extract_related_searches(result_set=serp)
sa.extract_related_questions(result_set=serp)

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

tk_apis-0.3.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tk_apis-0.3.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file tk_apis-0.3.1.tar.gz.

File metadata

  • Download URL: tk_apis-0.3.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for tk_apis-0.3.1.tar.gz
Algorithm Hash digest
SHA256 06eb0fd3a296f95d614de223f82611b93f291255fafd29368ddd99aae23ad878
MD5 be184187ab0b3322db17decd7f36269f
BLAKE2b-256 c708c5d2687b8b26645514b9d4c8203bb501b015992888cecc7740de9eccdadb

See more details on using hashes here.

File details

Details for the file tk_apis-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: tk_apis-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for tk_apis-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4bec8bc56f4ecfd989702bdc896c3562f1250609738fa1332f706cfa606ee6a
MD5 7518dc8e5779aca85306094fba6cbbae
BLAKE2b-256 46b6a4d5a57fc228dd4bc96dfb4b80c2a119aacbc70f4680555b2566da2240d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page