Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send breaks with recent versions of pbincli #12

Open
blacklight opened this issue Feb 18, 2025 · 0 comments · May be fixed by #13
Open

send breaks with recent versions of pbincli #12

blacklight opened this issue Feb 18, 2025 · 0 comments · May be fixed by #13

Comments

@blacklight
Copy link

blacklight commented Feb 18, 2025

The pbincli API now requires the presence of the auth parameter in the configuration. Without it, uploads fail:

File "/home/me/bin/paster", line 145, in <module>
  main()
  ~~~~^^
File "/home/me/bin/paster", line 128, in main
  rs = send_text(
      get_text(opts.file),
  ...<3 lines>...
      format=opts.format,
  )
File "/home/blacklight/me/paster", line 48, in send_text
  response = privatebinapi.send(
      'https://paste.example.org',
  ...<3 lines>...
      formatting=format,
  )
File "/home/me/.local/lib/python3.13/site-packages/privatebinapi/upload.py", line 123, in send
  data, passcode = prepare_upload(
                   ~~~~~~~~~~~~~~^
      server, text=text, file=file, password=password, expiration=expiration, compression=compression,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      formatting=formatting, burn_after_reading=burn_after_reading, discussion=discussion
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  )
  ^
File "/home/me/.local/lib/python3.13/site-packages/privatebinapi/upload.py", line 63, in prepare_upload
  api_client = PrivateBin(settings)
File "/home/me/.local/lib/python3.13/site-packages/pbincli/api.py", line 50, in __init__
  self.session = _config_requests(settings, False)
                 ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/me/.local/lib/python3.13/site-packages/pbincli/api.py", line 17, in _config_requests
  settings["auth"] and not shortener
  ~~~~~~~~^^^^^^^^
KeyError: 'auth'
blacklight added a commit to blacklight/privatebin-api that referenced this issue Feb 18, 2025
Uploads fail if it is not defined.

This also adds support for authented uploads. Two different modes are
currently supported by `pbcli`:

- `auth="basic"`, with `auth_user` and `auth_pass`.

- `auth="custom"`, with a custom `auth_headers` dict.

This also adds a round of LINT+Black to the modified files.

Closes: Pioverpie#12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant