Giter Club home page Giter Club logo

slurp_blog's Introduction

Slurp Blog

This project will copy blog post images and text from blogger.

Use

Pull down the latest post and images with the flowing:

python main.py --blog_url BLOG_URL --year 2021

Blog slurp doesn't provide too many options. You can list them by running python main.py -h:

usage: main.py [-h] [--blog_url BLOG_URL] [--year YEAR]

Slurp posts and images from blogger.

optional arguments:
-h, --help            show this help message and exit
--blog_url BLOG_URL, -b BLOG_URL
                        Blog Url
--year YEAR, -y YEAR  Year to slurp

Development

Setup your dev environment by creating a virtual environment

# virtualenv \path\to\.venv -p path\to\specific_version_python.exe
python -m venv .venv
.venv\scripts\activate

deactivate

Copy the example.env and replace values:

cp example.env .env

Style Guidelines

This project enforces quite strict PEP8 and PEP257 (Docstring Conventions) compliance on all code submitted.

We use Black for uncompromised code formatting.

Summary of the most relevant points:

  • Comments should be full sentences and end with a period.
  • Imports should be ordered.
  • Constants and the content of lists and dictionaries should be in alphabetical order.
  • It is advisable to adjust IDE or editor settings to match those requirements.

Ordering of imports

Instead of ordering the imports manually, use isort.

pip3 install isort
isort -rc .

Use new style string formatting

Prefer f-strings over % or str.format.

#New
f"{some_value} {some_other_value}"
# Old, wrong
"{} {}".format("New", "style")
"%s %s" % ("Old", "style")

One exception is for logging which uses the percentage formatting. This is to avoid formatting the log message when it is suppressed.

_LOGGER.info("Can't connect to the webservice %s at %s", string1, string2)

Testing

As it states in the Style Guidelines section all code is checked to verify the following:

  • All the unit tests pass
  • All code passes the checks from the linting tools

Local testing is done using Tox. To start the tests, activate the virtual environment and simply run the command:

tox

Testing outside of Tox

Running tox will invoke the full test suite. To be able to run the specific test suites without tox, you'll need to install the test dependencies into your Python environment:

pip3 install -r requirements_test.txt

Now that you have all test dependencies installed, you can run tests on the project:

isort -rc .
codespell  main.py
black main.py
flake8 main.py
pylint main.py
pydocstyle main.py

References

slurp_blog's People

Contributors

briglx avatar

Watchers

James Cloos avatar  avatar  avatar

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.