Skip to content

Commit

Permalink
final push
Browse files Browse the repository at this point in the history
  • Loading branch information
yashjoshi007 committed Oct 23, 2021
1 parent 3a92fa8 commit 301b54a
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 16 deletions.
Binary file added Assets/i1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
# fluthon

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# `Fluthon APP`

A new Flutter project which is supported from a python script and lists quotes .


## `Deployment` 📲
#
```bash
-> /Script - python main.py.

```
```
-> Run main.dart in the flutter project.
```
```
-> Fill in the data (Eg:- Motivation/Inspiration) in the provided space.
```

## 🛠 `Libraries Used`
#
- Flask
- request
- jsonify
- BeautifulSoup

## 📱 `Demo `
#
<h2 align= "left"><b>Quotes screen</b></h2>
<p align="left">

<img width=40% src="Assets/i1.png"> &ensp;

## `LICENSE`
#

Licensed under the [MIT LICENSE](LICENSE).
47 changes: 47 additions & 0 deletions Script/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@


from flask import Flask , request , jsonify
from bs4 import BeautifulSoup #used to pull out data from html , xml pages
import requests

app = Flask(__name__)


@app.route('/api/v1/',methods=['GET'])
def API():
if request.method == 'GET':
uri = 'https://www.brainyquote.com' # source of data
query = str(request.args['query'])
print(query)
if " " in query:
query = str(query).replace(" ","+")
else:
pass

search = '/search_results?q=' + query

ready_uri = uri + search
print(ready_uri)
content = requests.get(ready_uri).content
soup = BeautifulSoup(content, 'html.parser')
quotes_links = soup.find_all('a', {'class': 'b-qt'})
l = [] #list
for i in quotes_links:
d = {} #dictionary
quote_url = uri + i.get('href')
quote_content = requests.get(quote_url).content
quote_soup = BeautifulSoup(quote_content, 'html.parser')
d['quote'] = quote_soup.find('p', {'class': 'b-qt'}).text #class
d['author'] = quote_soup.find('p', {'class': 'bq_fq_a'}).text #class found using inspected elements
l.append(d)


return jsonify(l) #conversion to JSON format






if __name__ == '__main__':
app.run(port=5000) # any reference port is allowed

0 comments on commit 301b54a

Please sign in to comment.