Giter Site home page Giter Site logo

mdut's Introduction

Hi, I’m Nik.

What have you broken today? πŸ”₯

Jokes aside, there’s more from me on 🏑 nkantar.com (namely the πŸ–‹οΈ blog), and I sometimes toot as 🐘 @[email protected]. What follows here is just a v. quick rundown of what I’m working on in my spare time these days.

I maintain a few projects (in no particular order):

There’s more here, but it’s probably not really all that interesting. 😁

mdut's People

Contributors

nkantar avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ssklyg36

mdut's Issues

Add piping support + rethink copying

Currently mdut CLI puts the result into the system clipboard, which is super handy.

However, it may make more sense for it to just pipe it to stdout, and have a -c flag for copying as well, or even do that by default.

Add CD

Maybe publish to PyPI based on a git tag? TBD

Add CI

Just run errythang modd does, basically.

Handle httpx errors better

Some helpful error messages would be lovely, as currently they all just fall right through, like so:

❯ poetry run python src/mdut.py foo://bar
Traceback (most recent call last):
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_transports/default.py", line 187, in handle_request
    resp = self._pool.handle_request(req)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL has an unsupported protocol 'foo://'.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/nik/src/nkantar/mdut/src/mdut.py", line 68, in <module>
    mdut()
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/nik/src/nkantar/mdut/src/mdut.py", line 61, in mdut
    tag = markdown_url_tag(url, style)
  File "/Users/nik/src/nkantar/mdut/src/mdut.py", line 39, in markdown_url_tag
    html = fetch_html(url)
  File "/Users/nik/src/nkantar/mdut/src/mdut.py", line 20, in fetch_html
    return httpx.get(url).text
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_api.py", line 189, in get
    return request(
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_api.py", line 100, in request
    return client.request(
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_client.py", line 802, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_client.py", line 889, in send
    response = self._send_handling_auth(
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_client.py", line 917, in _send_handling_auth
    response = self._send_handling_redirects(
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_client.py", line 954, in _send_handling_redirects
    response = self._send_single_request(request)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_client.py", line 990, in _send_single_request
    response = transport.handle_request(request)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_transports/default.py", line 186, in handle_request
    with map_httpcore_exceptions():
  File "/opt/homebrew/Cellar/[email protected]/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/nik/Library/Caches/pypoetry/virtualenvs/mdut-kQOfudX7-py3.10/lib/python3.10/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL has an unsupported protocol 'foo://'.

copy shortcut

as a user: i want to see a link and press a special keyboard shortcut to activate mdut and copy the link, then go to my .md and paste it in there with all the syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.