Skip to main content

master================ django-instagram ================

A Django application that allows to use some template tags to display content from an Instagram public profile.

Requirements

Installation

Install Django with your favourite linux packaging system or you can use pip for installing python packages, if Django is not an official package for your distribution:

Use pip to install Django Instagram:

pip install django-instagram

Pip should take care of the package dependencies for Django Instagram.

Configuration

Add the application to INSTALLED_APPS:

INSTALLED_APPS = ('...',
                  'django_instagram',)

Rebuild your application database, this command depends on which version of Django you are using.

In Django 2.0 (recommended):

python manage.py makemigrations django_instagram

Them migrate the db:

python manage.py migrate

Usage

The instagram_user_recent_media brings into context two objects:

  • profile: Contains the who scraped object.

  • recent_media: Contains the recent media, like 10 or 12 entries or so.

A Django urls.py example using a TemplateView View class with a context variable called instagram_profile_name:

from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', TemplateView.as_view(template_name='index.html', extra_context={
        "instagram_profile_name": "amd"
    })),
]

You can display the data contained in recent_media list like this:

<!DOCTYPE html>

{% load instagram_client %}

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ instagram_profile_name|capfirst }} Instagram feed</title>
</head>
<body>
<h1>{{ instagram_profile_name|capfirst }} Instagram Feed</h1>
<div id="django_recent_media_wall">
    {% instagram_user_recent_media instagram_profile_name %}
    {% for media in recent_media %}
        <div class="django_instagram_media_wall_item">
            <a href="//instagram.com/p/{{ media.shortcode }}" target="_blank">
                <img src="{{ media.thumbnail_src }}"/>
                <span>{{ media.edge_media_to_caption.edges.0.node.text }}</span>
            </a>
        </div>
    {% endfor %}
</div>
<p>Got from instagram</p>
</body>
</html>

There are also two inclusion tags that includes an example of how to parse data from Instagram, you can also use them like this:

{% load instagram_client %}

<h1>Instagram media wall</h1>
{% instagram_recent_media_wall username="intel" %}

<h1>Instagram sliding box</h1>
{% instagram_recent_media_box username="intel" %}

Filters

As you may have noticed some filters can be used for sizing the pictures, here is the list of the usable fitlers:

For standard size:

{% for media in recent_media %}
...
<img src="{{ media.thumbnail_src|standard_size }}"/>
...
{% endfor %}

For low resolution images:

{% for media in recent_media %}
...
<img src="{{ media.thumbnail_src|low_resolution }}"/>
...
{% endfor %}

For thumbnail size:

{% for media in recent_media %}
...
<img src="{{ media.thumbnail_src|thumbnail }}"/>
...
{% endfor %}

Releases

  • 0.3.2 Compatibility fix for Django 3.

  • 0.3.1 Template tag accepts context variables.

  • 0.3.0 Updates to the scraping algorithm.

  • 0.2.0 New scraping algorithm, removed Python Instagram.

  • 0.1.1 Numerous bug fixes, better documentation.

  • 0.1.0 Work in progress version.

Metadata

Release files for django-instagram 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-instagram 0.3.2
File Size Uploaded
django-instagram-0.3.2.tar.gz 36.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-instagram 0.3.2
File Interpreter ABI Platform
django_instagram-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 73.3 kB

Release files / django-instagram-0.3.2.tar.gz

Download URL django-instagram-0.3.2.tar.gz
Size 36.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6646f9625b48931d674c3cbfc2feed6a0d1a70ee9138742d9644164e2dd1b739
BLAKE2b-256 checksum
How to use checksums
429245c8cdf92ae27de99597388f0c2261b5690490662cc8baf0baf5ba9a12c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / django_instagram-0.3.2-py3-none-any.whl

Download URL django_instagram-0.3.2-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08ffd4ac9c01c1a7f407216c752110721b0facc6e687648dfcea68df70c60aac
BLAKE2b-256 checksum
How to use checksums
c5e4ea859c8640add52d8cf539d638647722eeecdb835d36d316aba8428d6dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

1 release file

0.3.0

2 release files

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page