Skip to content

Instantly share code, notes, and snippets.

@apjanco
Created February 10, 2023 21:34
Show Gist options
  • Save apjanco/76968dab6892aa612ac5af94dd4ddcb6 to your computer and use it in GitHub Desktop.
Save apjanco/76968dab6892aa612ac5af94dd4ddcb6 to your computer and use it in GitHub Desktop.

App URL: https://nexis.pennds.org/UpennWSK/homepage/

Repo: https://github.com/upenn-libraries/lexis-wsk

To run the app docker-compose up

To access logs docker logs app

Ssh to container docker exec -it --user root lexis-wsk_app_1_fb447c17bae5 bash

In the container, the app lives here /var/www/lexis-wsk

Manage.py shell in container docker-compose run app /var/www/lexis-wsk/manage.py shell

Gunicorn logs tail -f /var/log/supervisor/gunicorn_err.log

  1. EMAIL messages not working because dependent on senderle.com
EMAIL_HOST_PASSWORD = os.environ['WSK_EMAIL_PASSWORD'].strip("'")
EMAIL_HOST_USER = 'postmaster@mg.senderle.com'
EMAIL_HOST = 'smtp.mailgun.org'
EMAIL_PORT = 465
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = 'Penn Lexis-Nexis Bulk Search <ln-bulk@mg.senderle.com>'
  1. OAUTH server returning error on token request
def get_token(client_id: str, secret: str) -> str:
    """Gets Authorizaton token to use in other requests."""
    auth_url = 'https://auth-api.lexisnexis.com/oauth/v2/token'
    payload = ('grant_type=client_credentials&scope=http%3a%2f%2f'
               'oauth.lexisnexis.com%2fall')
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    r = requests.post(
        auth_url,
        auth=HTTPBasicAuth(client_id, secret),
        headers=headers,
        data=payload)
    json_data = r.json()
    return json_data['access_token']

celery log

[2022-05-20 13:41:31,659: WARNING/Worker-3] File "/var/www/lexis-wsk/WSK/searchtask.py", line 348, in execute_one_search
    date_end, new_dirname, search_id
[2022-05-20 13:41:31,659: WARNING/Worker-3] File "/var/www/lexis-wsk/WSK/searchtask.py", line 218, in save_all_results
    search_response = self.api_request(request_url, request_headers)
[2022-05-20 13:41:31,660: WARNING/Worker-3] File "/var/www/lexis-wsk/WSK/searchtask.py", line 113, in api_request
    raise NexisApiError(str(search_response['error']))
[2022-05-20 13:41:31,660: WARNING/Worker-3] WSK.searchtask.NexisApiError: {'code': '', 'message': 'Value cannot be null.\r\nParameter name: userPermId'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment