python


Python-Instagram user_recent_media returning next of none


I'm retrieving posts from Instagram with Python and populating a MySQL database. The user is myself so I have excluded the userid= parameter although I have also tried it with this in place.
Below is a snippet of my code, when I print next_ at the end, it returns 'None' and so the second while loop doesn't start. The first iteration works fine and populates the database no problem.
The code should process through all posts, in the populate function I have an if statement to take care of posts that I already have in the database and intend to make this more sophisticated by stopping the code once I reach this point. But for now this should work.
Any ideas?
while True:
try:
media_feed, next_ = api.user_recent_media()
populate(media_feed)
print("Processing")
break
except InstagramAPIError as e:
if (e.status_code == "429"):
print(e)
print("Waiting")
Wait(3600)
else:
print(e)
break
print(next_)
while next_:
while True:
try:
media_feed, next_ = api.user_recent_media(with_next_url=next_)
populate(media_feed)
print("Processing")
break
except InstagramAPIError as e:
if (e.status_code == "429"):
print(e)
print("Waiting")
Wait(3600)
else:
print(e)
break

Related Links

Select all by type: Geometry. Equivalent Python script?
Sorting algorithm doesn't work
How to avoid “Name 're' is not defined” error while connecting pycharm remote debugger?
Python - Generate binary list with itertools
Capture domain and path from URL with regex
Pylab animation multiple figures
Django Password Reset Email Error 10060
Excel delimited file
Why is scrapy dumping thousands of `ERROR` log messages without any description of the error?
Python 2.5.4: how to find sum of logarithm values
Posting a json data in url — Python
How to Covert to dictionary in Python
Python __getitem__ error
How do I use the 'json' module to read in one JSON object at a time?
Error handling with verbose output
Python file transfer completes only after Control-C

Categories

HOME
batch-processing
numpy
shopify
crate
xamarin.android
bower
backup
d
actionscript
heap-memory
webdav
devstack
bro
proguard
goutte
shipping
qt-installer
local
store
typeahead
medium-editor
opera-mini
reduction
redux-observable
pyyaml
jcl
ejbca
shippo
dspic
tarantool
printdocument
version-numbering
cgal
data-conversion
websauna
getjson
clockwork
oracle-xml-db
ifstream
von-neumann
hashcat
rider
nlb
bigcartel
zero
visualstudio.testtools
rule
productivity
jrules
service-fabric-stateful
amd
encapsulation
spring-data-hadoop
chrome-remote-desktop
struts-layout
date-range
gulp-typescript
svn-merge
coremidi
pydio
wcf-ria-services
contour
gemini
supportmapfragment
post-processing
fortran90
license-key
hateoas
lemoon
drf-nested-routers
self-hosting
rad
sevenzipsharp
ipojo
lines-of-code
xaml-designer
httpie
hiera
sysfs
java-melody
outline
visual-studio-addins
driver-signing
jqmobi
dynamic-binding
symphony-cms
fileconveyor
fortran77
reporting-tools
magickwand
xml-libxml
pitch
fotoware
scrollto
macruby
jpf
objective-c-protocol
flash-cs5.5
cross-domain-policy
throttling
coff
galaxy-tab
audiostreamer
j-interop
osx-leopard
nt4
dirty-data

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App