Skip to content

Code example in README.st fails #17

@scharf

Description

@scharf

Running the following code (from README.st)

import os
import neverbounce_sdk

API_KEY = os.environ.get('NEVERBOUNCE_API_KEY', '')

client = neverbounce_sdk.client(api_key=API_KEY, timeout=30)

emails = [
    {'email': 'tomato@veggies.com'},  # must have an 'email' key
    {'email': 'cucumber@veggies.com',
     'best_when': 'cold'},  # may contain "metadata"
]
job = client.jobs_create(emails)

# all state-changing methods return a status object
resp = client.jobs_parse(job['job_id'], auto_start=False)
assert resp['status'] == 'success'

client.jobs_start(job['job_id'])
progress = client.jobs_status(job['job_id'])
print(progress)  # dict with keys 'job_status', 'started', 'percent_complete', etc

Raises an error:

raceback (most recent call last):
  File "/tmp/call_neverbounce.py", line 19, in <module>
    client.jobs_start(job['job_id'])
  File "/Users/scharf/git/tye/tye-bpa/python/.venv/lib/python3.8/site-packages/neverbounce_sdk/bulk.py", line 352, in jobs_start
    self._check_response(resp)
  File "/Users/scharf/git/tye/tye-bpa/python/.venv/lib/python3.8/site-packages/neverbounce_sdk/core.py", line 146, in _check_response
    raise exc(message, execution_time)
neverbounce_sdk.exceptions.GeneralException: ('We were unable to complete your request. The following information was supplied: This job is not in a state which can be ran.\n\n(general_failure)', 322)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions