marcopompili / django-instagram Goto Github PK
View Code? Open in Web Editor NEWInstagram application for Django.
License: BSD 3-Clause "New" or "Revised" License
Instagram application for Django.
License: BSD 3-Clause "New" or "Revised" License
Django Instagram was working, but now I receive the following error only in Production. In my development environment it works fine. It was working in production yesterday.
Traceback (most recent call last):
django_1 | File "/usr/local/lib/python3.6/site-packages/django_instagram/templatetags/instagram_client.py", line 34, in get_profile_media
django_1 | edges = profile['entry_data']['ProfilePage'][page]['graphql']['user']['edge_owner_to_timeline_media']['edges']
django_1 | KeyError: 'ProfilePage'
I have downloaded and "python setup.py install" the package, added 'django_instagram' to the INSTALLED_APPS but receive a "ImportError: No module named templatetags" error when starting the server with "./manage.py runserver".
Admins-MacBook-Air-3:kahuna Administrator$ ./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/init.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/contrib/admin/init.py", line 23, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/Users/Administrator/anaconda/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django_instagram-0.1-py2.7.egg/django_instagram/admin.py", line 15, in
ImportError: No module named templatetags
I enabled caching and then things broke - I could see there was a 403 error trying to fetch images from Instagram. It took me a while, but it turns out that sorl-thumbnail
removes URL parameters by default, which breaks requests to Instagram (not sure if this is a change from the past).
To fix this you need to add this to your settings:
THUMBNAIL_REMOVE_URL_ARGS = False
Hi,
I am using django-instagram client for first time. I am using django 3.2. I following the usage example but on console there are error, Here is the log:
ERROR:root:user profile "mr.nasir.hussain45" not found
Traceback (most recent call last):
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 28, in instagram_scrap_profile
page.raise_for_status()
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: - for url: https://www.instagram.com/accounts/login/
ERROR:root:scripts not found
Traceback (most recent call last):
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 44, in instagram_profile_js
return tree.xpath('//script')
AttributeError: 'NoneType' object has no attribute 'xpath'
Note (mr.nasir.hussain45 is a public profile)
The media url is wrong in example since Instagram has change his json structure.
Instead of using :
{{ media.display_src }}
Please use :
{{ media.shortcode }}
Full working example :
{% load instagram_client %}
{% instagram_user_recent_media intel %}
<div id="django_recent_media_wall">
{% for media in recent_media %}
<div class="django_instagram_media_wall_item">
<a href="{{ media.shortcode }}" target="_blank" title="{{ media.caption }}">
<img src="{{ media.thumbnail_src }}"/>
<span>{{ media.caption }}</span>
</a>
</div>
{% endfor %}
</div>
Hi, I had fetch all posts from Instagram normally but I don't know how now I get this error when start runserver.
Django==2.0.7
ERROR:root:user profile "rbrz" not found
Traceback (most recent call last):
File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/django_instagram/scraper.py", line 28, in instagram_scrap_profile
page.raise_for_status()
File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: No server is available for the request for url: https://www.instagram.com/encruzilhadapneus/
ERROR:root:scripts not found
Traceback (most recent call last):
File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/django_instagram/scraper.py", line 44, in instagram_profile_js
return tree.xpath('//script')
AttributeError: 'NoneType' object has no attribute 'xpath'
Any suggestions?
Best.
Hi,
I cannot install your module using pip. This is my traceback :
pip install django-instagram
Downloading/unpacking django-instagram
Could not find any downloads that satisfy the requirement django-instagram
Cleaning up...
No distributions at all found for django-instagram
Storing debug log for failure in /home/zea/.pip/pip.log
Thank you :)
I pass a variable to the template that I call username. It contains the username of the instagram user. When I try to do this for example :
<p>{{ username }}</p>
. It works perfectly. It's displaying the good username.
But when I use the tag {% instagram_user_recent_media username %}
, it takes username as a string. So the app search on Instagram with the username "username". Obviously it don't find anything. I also tried to do that : {% instagram_user_recent_media {{ username }} %}
Originally posted by @Abdullahabid3691 in #18 (comment)
As @Abdullahabid3691 made me notice, the tag {% instagram_user_recent_media %}
only accepts raw strings. It would make more sense to use a context variable.
So there seems to be an update that disallows crawled images from Instagram.
I get "content can load" even though the images appear in the browser normally.
I've tried googling it however I can't seem to find any answer directly related to this app.
I have disabled the apps and it works so I presume it must be related to django-instagram.
This has worked perfect to add to a small project I'm working on. Thanks for your efforts.
file instagram_client.py line 35,
file scrapper.py line 58
Instagram App was probably moved to sandbox mode:
https://www.instagram.com/developer/sandbox/
This causes errors:
The ReST version of the README (which appears on pypi) references an admin page that no longer exists, which is very confusing.
Unexpectedly an application started to display the following error:
KeyError at /
'user'
[...] python2.7 / site-packages / django_instagram / templatetags / instagram_client.py in get_profile_media, line 23
[...] python2.7 / site-packages / django_instagram / templatetags / instagram_client.py in get_profile_media
return profile ['entry_data'] ['ProfilePage'] [page] ['user'] ['media'] ['nodes']
Anyone else with this issue?
Having a really strange issue that is only present on my website on the production server (everything seems to work fine in the dev server). I'm using Django 2.2.
The Instagram feed I'm trying to query doesn't display, or only displays intermittently (if I just keep refreshing the page sometimes the feed will display, and sometimes it won't). I'm not getting any errors in my gunicorn, django, or nginx error logs.
When I look at where the Instagram feed should be injected into the html using devtools there is an element of:
<div class="slick-track" role="listbox" style="opacity: 1; width: 0px; transform: translate3d(317px, 0px, 0px);"></div>
but nothing is inside it, and there isn't an empty div for each image URL pulled in so I know it's not even grabbing any URL's.
Here is my html for calling the Instagram client:
{% load instagram_client %}
<div class="gallery-slider-2 z-index">
<div class="gallery-active">
{% instagram_user_recent_media "nm_asian_family_center" %}
{% for media in recent_media %}
<div class="gallery-slider-img {% if forloop.counter == 1 %}slick-current{%endif%}">
<a href="//instagram.com/p/{{ media.shortcode }}" target="_blank">
<img class="grow-insta" src="{{ media.thumbnail_src }}" alt=""></a>
</div>
{% endfor %}
</div>
</div>
</div>
Everything displays fine when I look at the site in my django dev server. I've only had these issues on my production server, and all other static files are loading fine. I'm guessing it might be some server configuration?
Any help or guidance is greatly appreciated!
EDIT
it's also worth noting that the package had been working fine on my production server just a few days ago. I made no changes to the site between when it was working fine and when I started having these issues.
will this app work with django 1.8+? are you planning to update the support?
Hi, I am using this package in my django project. And i want to know how can i fetch all the posts from instagram, as currently i am only able to fetch recent 12 posts. Thanks in advance.
I installed the latest release (0.3.1) on Django 3.0.5, but I didn't get any database migrations which the documentation suggests will happen. Will it work on Django 3?
Hi Marco,
I following your instructions. All dependies installed. DB synchronized.
I copied and pasted code from "Usage" section. And I getting error:
Invalid block tag on line 5: 'instagram_user_recent_media'. Did you forget to register or load this tag?
What should I do now?
Hi,
when I press on get token (after logging in) I get this error message:
{"error_type": "OAuthException", "code": 400, "error_message": "Invalid Client ID"}
http://www.emarcs.net/instagram/ returns 404
any way to fix it?
Thanks
I'm trying to deploy my site to Heroku where I intend to use django-compressor on my CSS and Javascript files. I get the following messages when I run python manage.py compress
.
Invalid template /usr/local/lib/python3.7/site-packages/django_instagram/templates/django_instagram/recent_media_wall.html: 'staticfiles' is not a registered tag library.
and
Invalid template /usr/local/lib/python3.7/site-packages/django_instagram/templates/django_instagram/recent_media_box.html: 'staticfiles' is not a registered tag library.
Is this related to Django 3.x removing {% load staticfiles %}
? See this StackOverflow post for info.
Would {% load static instagram_client %}
be the new, correct syntax?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.