semvec/pypi-packages huggingface dataset:
django_geoip_redirection 0.1.3
GeoIP based redirection middleware
License: MIT

[![Build Status](https://travis-ci.org/vinitkumar/django-geoip-redirection.svg?branch=master)](https://travis-ci.org/vinitkumar/django-geoip-redirection)

Django-geoip-redirection
========================

![World Map](https://i.cloudup.com/7rf2v_IDxv-2000x2000.png)

GeoIP based redirection is awesome and achieving it isn't too hard either. I wrote this middleware 
to ensure that my website would get redirected properly with regards to the location of the user
accessing the website.


## Usage:

Add the middleware in your settings file:

```python
MIDDLEWARE_CLASSES = (
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'cms.middleware.language.LanguageCookieMiddleware',
  'django_geoip_redirection.middleware.LocationMiddleWare',
)
```

Also add `django_geoip_redirection` to INSTALLED APPS:

```python
INSTALLED_APPS = (
  'django_geoip_redirection',
  ....
)
```

## Customization:

```python
# Change the array for extension as per country you 
# have to support
if request.path[:4] in ["/en/", "/nl/", "/in/"]:
    return None

if 'HTTP_X_FORWARDED_FOR' in request.META:
    request.META['REMOTE_ADDR'] = request.META['HTTP_X_FORWARDED_FOR']
ip_address = request.META['REMOTE_ADDR']
# get country name using Maxmind database.
# Now, just match and redirect.
# Likewise, replace the name of country to match and redirect.
country = get_country_request(ip_address)
if country == "India":
    return HttpResponseRedirect('/in/')
elif country == "Netherlands":
    return HttpResponseRedirect('/nl/')
else:
    return HttpResponseRedirect('/en/')
return None

```

You would also need to place the `GeoIP.dat.dat` present inside the data folder to
your project root directory.
pyplyn 0.1.5
Only one-way pipeline (pyplyn) for data handling in Python
License: MIT

pyplyn: One-way only pipeline for data handling
===============================================

.. image:: https://badge.fury.io/py/pyplyn.svg
    :target: http://badge.fury.io/py/pyplyn


.. image:: https://pypip.in/d/pyplyn/badge.png
    :target: https://crate.io/packages/pyplyn/

.. image:: https://pypip.in/license/pyplyn/badge.png
    :target: https://github.com/tdgunes/pyplyn/blob/master/LICENSE

Pyplyn is an MIT Licensed simple flow-based data handling structure for making
data handling repetitive tasks, easily without repeating yourself for every
different scenario.

It is based on Python's lovely generators, so for every data flow into the pipe
is in an iterative fashion. It is currently used in a research project to handle
some repetitive daily tasks. (Moving, filtering, altering the data)

Still the pyplyn module that is used in the project has some dirty but useful
components like progressbar, ML based classification filter and so on, with this
simple library, I think there can be a common simple ground for handling our
repetitive tasks.

Installation
============

In order to install pyplyn, just simply::

    pip install pyplyn

Or alternatively, download the package from pypi_, extract and execute::

    python setup.py install

.. _pypi: http://pypi.python.org/pypi/pyplyn

Quick Start
===========

Pyplyn aims to make data handling in a flow based fashion::

    import pyplyn as p

    pipe = p.Pipe()
    pipe.add(p.LineReader("hello.txt"))
    pipe.add(p.LambdaFilter(lambda line: len(line) < 50))
    pipe.add(p.LineWriter("small_hello.txt"))
    pipe.run()

You can even write your own Pyp modules as simple as this::

    import pyplyn as p
    import pymongo

    class MongoCollection(p.InPypElement):
        def __init__(self, db, collection):
            self.collection = pymongo.MongoClient()[db][collection]
        def grasp(self):
            for document in self.collection:
                yield document

Add this new pipe element to your current flow by::

    pipe = p.Pipe()
    pipe.add(MongoCollection("data","raw"))
    pipe.add(p.LambdaExtension(lambda document: document["text"])
    pipe.add(p.LineWriter("data_text.txt"))

..

Documentation
=============
Sorry, it is currently not available, but I recommend you to check the source, it is
pretty straightforward for now.

Contribute
==========
Any contribution is welcome.
pyramid_genshi 0.2.1
Genshi template bindings for the Pyramid web framework
License: MIT
Keywords: bfg pyramid pylons genshi templates

pyramid_genshi
==============

Build:

.. image:: https://travis-ci.org/victorlin/pyramid_genshi.png?branch=master   
  :target: https://travis-ci.org/victorlin/pyramid_genshi

Bindings for `Genshi <http://genshi.edgewall.org/>`_ templating support under
`Pyramid <http://docs.pylonsproject.org/>`_.

To use pyramid_genshi, simply include pyramid_genshi in your Pyramid main 
function::

    config.include('pyramid_genshi')
    
And you can use it as you use other template::

    @view_config(route_name='home',
                 renderer='my_project:templates/home.genshi')
    def home(request):
        return 'Hello world'
        
Settings
--------
        
To adjust output format, you can change `genshi.default_format` ::

    genshi.default_format = xhtml
    
To adjust output encoding, you can change `genshi.default_encoding` ::

    genshi.default_encoding = cp950
    
To adjust output doctype, you can change `genshi.default_doctype` ::

    genshi.default_doctype = html5
   
To adjust the default i18n domain, you can change `genshi.default_domain` ::

    genshi.default_domain = my_domain
    
To adjust template auto reloading, you can change `genshi.auto_reload` ::

    genshi.auto_reload = False
    
For available options, you can reference to 
`<http://genshi.edgewall.org/wiki/Documentation/0.6.x/plugin.html>`_


0.2.1
-----

- Support include template by Pyramid asset path


0.2.0
-----

- Support Pyramid 1.5
- Stop supporting Pyramid before 1.3
- Stop supporting text rendering for now, may be added back later


0.1.3
-----

- Fix issue caused by Pyramid 1.4 macro argument to the template renderer

0.1.2
-----

- Add genshi.auto_reload setting option, and make the default value as True

0.1.1
-----

- Add genshi.default_encoding setting option
- Add genshi.default_doctype setting option
- Add genshi.default_format setting option (same as genshi.method in 0.1.0)

0.1.0
-----

-  Initial version