Skip to content

Instantly share code, notes, and snippets.

View Riyas3's full-sized avatar

Riyasutheen Abdul Rahman Riyas3

View GitHub Profile
@Riyas3
Riyas3 / diff_of_scrapy_Compose_and_MapCompse.py
Created September 23, 2019 08:02 — forked from crazygit/diff_of_scrapy_Compose_and_MapCompse.py
The difference of scrapy built in loader processor Compose and MapComose
from scrapy.loader.processors import Compose, MapCompose
proc = Compose(lambda v: v[0], str.upper)
proc(['hello', 'world']) # HELLO
mproc = MapCompose(lambda v: v[0], str.upper)
mproc(['hello', 'world']) # ['H', 'W']
#models.py
from django.db import models
class Reporter(models.Model):
full_name = models.CharField(max_length=70)
def __str__(self):
return self.full_name
@Riyas3
Riyas3 / deploying_simple_api.md
Created October 23, 2019 11:23 — forked from prodeveloper/deploying_simple_api.md
Deploying your RESTful API to heroku

In this session, we are going to mimic a posts api that we worked on in a previous class. Typecode provides the free sample api.

APIs are what enable the backend, frontend and your mobile application to work together. We have also seen how to build basic REST api using Django Rest Framework

To get the post API to work we will need to work on four modules:

Cheatsheet for Django QuerySets

Current Django Version: 2.2

Methods that return new QuerySets

Can be chained:

Entry.objects.filter(**kwargs).exclude(**kwargs).order_by(**kwargs)

Source: https://www.toptal.com/python/tips-and-practices

This resource contains a collection of Python best practices and Python tips provided by our Toptal network members. As such, this page will be updated on a regular basis to include additional information and cover emerging Python techniques. This is a community driven project, so you are encouraged to contribute as well, and we are counting on your feedback.

Python is a high level language used in many development areas, like web development (Django, Flask), data analysis (SciPy, scikit-learn), desktop UI (wxWidgets, PyQt) and system administration (Ansible, OpenStack). The main advantage of Python is development speed. Python comes with rich standard library, a lot of 3rd party libraries and clean syntax. All this allows a developer to focus on the problem they want to solve, and not on the language details or reinventing the wheel.

Check out the Toptal resource pages for additional information on Python. There is a Python hiring guide, Python job

@Riyas3
Riyas3 / celery.py
Created January 23, 2020 06:12 — forked from Lh4cKg/celery.py
Installing And Configuration Django 1.10 && Celery 4.0.2 && RabbitMQ
1. django (latest version)
$ pip install django
2. celery (latest version)
$ pip install celery
first steps
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
install celery extension
$ pip install django-celery-beat
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#django-celery-beat
@Riyas3
Riyas3 / curl.md
Created July 4, 2020 07:52 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Riyas3
Riyas3 / README.md
Created July 26, 2020 20:16 — forked from mau21mau/README.md
Configure Celery + Supervisor With Django
; ==================================
; celery worker supervisor
; ==================================
[program:celery]
command=/path/to/home/.virtualenvs/celery_env/bin/celery worker -A app.celery --loglevel=INFO
directory=/path/to/home/celery-scheduler
user=root
numprocs=1