Skip to main content

A Python client for the Crabber REST API.

Project description

python-crabber

PyPI version ReadTheDocs

A Python client for the Crabber.net REST API.

Installation

pip install python-crabber

Documentation

You can find the full documentation at ReadTheDocs.

Usage

>>> import crabber
>>> help(crabber.API)

Authentication is done with developer/api keys and access tokens. You can get both of these at https://crabber.net/developer/. Only an API key is needed to access Crabber's API.

>>> api = crabber.API(api_key=YOUR_DEVELOPER_KEY)
>>> jake = api.get_crab_by_username('jake')
>>> jake
<Crab @jake [1]>
>>> jake.display_name
'Jake L.'

If you want to make actions on a user's behalf you'll need to authenticate with an access token. Access tokens are tied to specific accounts, so if you create an access token while logged in as '@thedude' then all applications authenticated with that access token will act as if they are logged in as '@thedude'. This is why it is imperative that access tokens are kept private and not shared with anyone.

>>> jake = api.get_crab_by_username('jake')
>>> jake.follow()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jake/code/python-crabber/crabber/models.py", line 342, in follow
    raise RequiresAuthenticationError(
crabber.exceptions.RequiresAuthenticationError: You are not properly authenticated for this request.
>>> api.authenticate(YOUR_ACCESS_TOKEN)
>>> jake.follow()
True
>>> api.get_current_user() in jake.followers
True
>>> api.post_molt('Hello, world!')
<Molt [683]>

It is also possible to authenticate while intializing the API object rather than afterwards.

>>> api = crabber.API(api_key=YOUR_DEVELOPER_KEY, access_token=YOUR_ACCESS_TOKEN)
>>> api.get_current_user()
<Crab @thedude [85]>

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

python-crabber-1.1.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

python_crabber-1.1.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file python-crabber-1.1.1.tar.gz.

File metadata

  • Download URL: python-crabber-1.1.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Darwin/21.1.0

File hashes

Hashes for python-crabber-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2c0f4d765f9620d2d261e1bc1fa0c5ac4e70fb4db35b51f4112d7299f75e76c1
MD5 79f4dad1dd298852b65d5dd8ee5f03a9
BLAKE2b-256 1ce80b276c391fc80089b9edeacc1685b00d11a0fe0dccbad00dee6859324cef

See more details on using hashes here.

File details

Details for the file python_crabber-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: python_crabber-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Darwin/21.1.0

File hashes

Hashes for python_crabber-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 390bb6e958b37bfe385c7195c8ae5b0f52f71078c65a97c8a706580874c204a2
MD5 99ed54069ebab35efca5949d1203d8e7
BLAKE2b-256 fe7ec3fe3ea32d295c061cc5dc13adcd68c290da749a045750130a7514417775

See more details on using hashes here.

Supported by

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