Element -- selects all h2
elements on the page
h2 {
foo: bar;
{ | |
"AF": "Afghanistan", | |
"AX": "Aland Islands", | |
"AL": "Albania", | |
"DZ": "Algeria", | |
"AS": "American Samoa", | |
"AD": "Andorra", | |
"AO": "Angola", | |
"AI": "Anguilla", | |
"AQ": "Antarctica", |
from scrapy.spider import BaseSpider | |
from scrapy.contrib.spiders import CrawlSpider, Rule | |
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor | |
from scrapy.http import FormRequest | |
from scrapy.selector import HtmlXPathSelector | |
from tutorial.items import GoogleItem | |
# This is the class that does work. | |
class LoginSpider(BaseSpider): | |
name = 'google-login' |
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung |
from django.utils.safestring import SafeUnicode | |
""" | |
When overriding Django admin templates |safe and autoescape off don't work, so do this instead... | |
""" | |
# for a foreign key field in the change form, if you want to override the unicode method, use a proxy | |
class UserProxy(User): | |
""" | |
Using a proxy to present the required formatting: username, email, full name |
#signals.py | |
from django.dispatch import Signal | |
user_login = Signal(providing_args=["request", "user"]) | |
#views.py | |
from foo import signals |
projectname = 'bashoneliners' | |
virtualenv_root = '/path/to/virtualenv/' + projectname | |
import sys | |
import os | |
INTERP = os.path.join(virtualenv_root, 'bin', 'python') | |
if sys.executable != INTERP: | |
os.execl(INTERP, INTERP, *sys.argv) |
AIRTIME | |
Api name: | |
mobilenigcom | |
Api url: | |
https://mobilenig.com/API/airtime?username=****&api_key=****&network=[network_code]&phoneNumber=[phone]&amount=[amt]&trans_id=[ordernumber] | |
Api url data: | |
{"data":{"apikey":"[YOUR_API_KEY]", "userid":"[USER_ID]", "network_id":"[network_code]", "amount":"[amt]", "phoneno":"[phone]"}, "headers":{"authorization": "Bearer (API_KEY)"}} |