Skip to content

Commit

Permalink
Merge pull request #13 from aditigupta96/swati
Browse files Browse the repository at this point in the history
Updated README.md
  • Loading branch information
swatilodha committed Apr 17, 2016
2 parents b2eb910 + 2316234 commit 73e2ac8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# imageBucket
- ABOUT --------------------------------------------------------------------

ImageBucket is an application used to view Instagram pictures.
You can enter multiple tags(seperated by comma) to view the images.

- FEATURES --------------------------------------------------------------------

1)View Instagram pictures.
2)Search using multiple tags is allowed.
3)Picture can be downloaded on system.


6 changes: 3 additions & 3 deletions imageBucket/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from search import views

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^search/$',views.search_tag,name = 'search_tag'),
url(r'^$',views.home, name = 'home'),
url(r'^admin/', admin.site.urls),
url(r'^search/$',views.search_tag,name = 'search_tag'), #URL to search images
url(r'^$',views.home, name = 'home'), #URL for the home page
]
2 changes: 1 addition & 1 deletion search/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}
</style>
<meta charset="utf-8">
<title>Insta Search using tags</title>
<title>ImageBucket</title>

</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion search/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
</style>
<meta charset="utf-8">
<title>Insta Images</title>
<title>ImageBucket</title>

</head>
<body>
Expand Down
16 changes: 8 additions & 8 deletions search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@

base_url = "https://api.instagram.com/v1/"

def home(request):
def home(request): #function to display home page
response = TemplateResponse(request, 'index.html',{})
return response

def search_tag(request):
def search_tag(request): #searches image

if request.method == "POST":

tag = request.POST.get("tag")
tag_list = tag.split(",")
tagname = tag_list[0]
url = base_url + "tags/" + tagname + "/media/recent?access_token=260885964.45f1b46.21e98a2bae1a46dab31568d770197a0a"
tag_list = tag.split(",") #tags stored in list
tagname = tag_list[0] #search based on first tag
url = base_url + "tags/" + tagname + "/media/recent?access_token=260885964.45f1b46.21e98a2bae1a46dab31568d770197a0a"
resp = requests.get(url)

json = resp.json()
json = resp.json() #json file with images after first tag
image_link = []

for data in json['data']:
present = True
all_tag = data['tags']
input_tags = tag_list[1:]

for item in input_tags:
for item in input_tags: #checks if all tags are present
if (item not in all_tag):
present = False
present = False #present changes to false if any one tag is not found
break

if present:
Expand Down

0 comments on commit 73e2ac8

Please sign in to comment.