GithubHelp home page GithubHelp logo

florimondmanca / asgi-sitemaps Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 0.0 53 KB

Sitemap generation for Python ASGI web apps

Home Page: https://pypi.org/project/asgi-sitemaps/

License: MIT License

Python 96.16% Makefile 3.84%
asgi async fastapi python sitemap-generator starlette

asgi-sitemaps's Introduction

NOTICE

Now unused. See florimondmanca/www.


Personal

Build Status Angular DigitalOcean

This is the repository for the frontend application powering my personal blog.

For the backend API, see personal-api.

Install

Install Angular CLI:

$ npm install -g @angular/cli

Install the dependencies:

$ npm install

Quickstart

Create an environment file called .env (it will be excluded from version control) at the project root, containing the following variables:

  • API_KEY: a valid API key created via the backend admin site.
  • BACKEND_URL: the URL to the backend root (without trailing slash).

For example:

# .env
API_KEY=myapikey
BACKEND_URL=http://localhost:8000

Generate your development environment file:

$ npm run config -- --env=dev

Start the development server, which will run on http://localhost:4200/:

$ ng serve -c dev

Using server-side rendering

Server side rendering is implemented using Angular Universal.

Server-side rendering allows to send fully-rendered HTML pages to clients, instead of sending them a blank page and letting Angular fill it in the browser. This reduces the "first meaningful paint" time, helps with referencing and allows integration with social media.

To use the server-rendered app, you must first create a build of the app:

$ npm run build:dev

Note: in production, use npm run build instead to create a production-optimized build.

Then start the server-rendered app (an Express server):

$ npm run serve:ssr

Scripts

See package.json for the available NPM scripts.

CI/CD

TravisCI is configured on this repo and generates a production build on every push to a branch.

asgi-sitemaps's People

Contributors

florimondmanca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

asgi-sitemaps's Issues

Improve error message in case of HTTP request error

Hi, just read your announcement on Twitter and gave it a try...

❯ python -m sitemaps https://www.apis.de
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/sitemaps/__main__.py", line 6, in <module>
    sys.exit(anyio.run(main, sys.argv[1:]))
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/anyio/__init__.py", line 68, in run
    return asynclib.run(func, *args, **backend_options)  # type: ignore
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 99, in run
    raise exception
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 67, in wrapper
    retval = await func(*args)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/sitemaps/_main.py", line 89, in main
    urls = await crawl(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/sitemaps/_crawl.py", line 31, in crawl
    await _add(root_url, parent_url="", config=config, state=state)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 375, in __aexit__
    raise exceptions[0]
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 398, in _run_wrapped_task
    await func(*args)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/sitemaps/_crawl.py", line 55, in _process
    response = await config.client.get(url)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1305, in get
    return await self.request(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1147, in request
    response = await self.send(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1168, in send
    response = await self.send_handling_redirects(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1195, in send_handling_redirects
    response = await self.send_handling_auth(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1232, in send_handling_auth
    response = await self.send_single_request(request, timeout)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpx/_client.py", line 1264, in send_single_request
    ) = await transport.request(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 152, in request
    response = await connection.request(
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_async/connection.py", line 78, in request
    return await self.connection.request(method, url, headers, stream, timeout)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_async/http11.py", line 62, in request
    ) = await self._receive_response(timeout)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_async/http11.py", line 115, in _receive_response
    event = await self._receive_event(timeout)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_async/http11.py", line 145, in _receive_event
    data = await self.socket.read(self.READ_NUM_BYTES, timeout)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_backends/asyncio.py", line 134, in read
    return await asyncio.wait_for(
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/jugmac00/Tests/sitemaps/sitemaps/lib/python3.8/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore._exceptions.ReadTimeout

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.