Skip to main content

Asynchronous TrendHunter API (in Python)

Project description

Python TrendHunter API

Overview

The TrendHunter API is a command line interface for scraping information from the TrendHunter Ideas database.

  • trends
  • lists
  • categories
  • search

Installation

The library can be installed via the Python Package Index,

pip install trendhunter

Note the most recent version is 0.0.2

Usage

The API is implemented through Python Click, a command line interface. The API supports 4 subcommands,

  • trends
  • lists
  • categories
  • search

Every command accepts a number of optional arguments, and one required argument. The required argument is the name of the TrendHunter site from which you want to base your query. This argument is called the uid, and must come after the subcommand.

The optional arguments are best described via an example. The following excerpt is the Python Click help page for the trends subcommand.

Usage: trendhunter trends [OPTIONS] UID

Options:
  -n INTEGER                      Number of articles. The API default is to
                                  return 50 articles matching the provided
                                  uid, but the `n` option is used to customize
                                  this value.  [default: 50]
  -k, --chunksize INTEGER         Size of a simultaneously-processed article
                                  chunk. The API default is to process 100
                                  articles at one time. Decrease this value to
                                  reduce memory usage.  [default: 100]
  -c, --concurrency INTEGER       Number of concurrent requests. The API
                                  default is to send 5 concurrent requests,
                                  but can be increased to 100. You may want to
                                  limit concurrency to avoid 429 errors on the
                                  TrendHunter API.  [default: 5]
  -p, --proxy TEXT                The HTTP url of a proxy server. The API
                                  default is to not use a proxy server, but if
                                  the TrendHunter API bans your IP address,
                                  you can provide one here. Please try to use
                                  a VPN before resorting to using a proxy
                                  server. If you do need to use a proxy,
                                  please be aware of the considerable risk if
                                  the provider is not secure.
  -t, --timeout INTEGER           Number of seconds until a request times out.
                                  The API default is to allow 10 seconds for a
                                  request to complete. If you are receiving
                                  several timeout exceptions, try to increaase
                                  this value.  [default: 10]
  -f, --format [0|1]              The output format. The API default (0) is to
                                  format the output to the console. If the
                                  user would prefer to output the details to a
                                  PowerPoint file, the 1 value can be used.
                                  [default: 0]
  -l, --loglevel [10|20|30|40|50]
                                  The log level of the root Python logger. The
                                  API default is to log anything at or above
                                  the INFO level. Decrease the value to view
                                  more verbose logs.  [default: 20]
  -d, --directory DIRECTORY       The directory to write any output files. If
                                  one is not passed, the output directory will
                                  be the current directory.
  -x, --pixels <INTEGER INTEGER>...
                                  The maximum resolution of any created image
                                  files. The API default is to limit a
                                  thumbnail to a dimension of (300, 300). If
                                  an image is not equal in width and height
                                  dimension, the increase in resolution will
                                  be halted when the aspect ratio forces the
                                  larger dimension to hit the boundary
                                  specified here.  [default: 300, 300]
  --help                          Show this message and exit.

At any point, if you get stuck and would like to reference the required and optional arguments, you can view the Click help page for either the base trendhunter command or one of the subcommands,

> trendhunter --help
> trendhunter trends --help

Examples

> trendhunter trends holiday-giveaways
> trendhunter lists 2023-tech-trends
>trendhunter categories food
> trendhunter search candy

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

trendhunter-0.0.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

trendhunter-0.0.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file trendhunter-0.0.2.tar.gz.

File metadata

  • Download URL: trendhunter-0.0.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for trendhunter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7b2dabac038aee803f216b94de53fbb3466726d2d857001c3d5ff47fc0efbc22
MD5 6d65424223514cd3f8dcd73099a8bed9
BLAKE2b-256 37c7efb276da0927e60852174d03550a5afdf01dc9a1a47c54aefbe1749596b1

See more details on using hashes here.

File details

Details for the file trendhunter-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: trendhunter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for trendhunter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6cea2254a163a2dff432ba06ded71f5d14f69a0c43b9d3efde20cf43d45e2d1e
MD5 6cfe83b46d51a9ea33d957c085df1888
BLAKE2b-256 5b405c5fb0b3460685d33c87ee8784729110219e047583fa12daff3acc78399c

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