Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
trenddit-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raj Singh Gogia
trenddit-backend
Commits
3f9a7f9b
Commit
3f9a7f9b
authored
2 years ago
by
Harkanwar Singh Waraich
Browse files
Options
Downloads
Patches
Plain Diff
Updated Variables
parent
4385385c
No related branches found
No related tags found
1 merge request
!2
Firebase init
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
praw-api.py
+12
-11
12 additions, 11 deletions
praw-api.py
reddit-oauth.py
+8
-3
8 additions, 3 deletions
reddit-oauth.py
requirements.txt
+57
-57
57 additions, 57 deletions
requirements.txt
run.sh
+8
-1
8 additions, 1 deletion
run.sh
with
87 additions
and
73 deletions
.gitignore
+
2
−
1
View file @
3f9a7f9b
...
...
@@ -130,4 +130,5 @@ dmypy.json
firebase_tools/trenddit-db-cred.json
tokens.txt
.DS_Store
\ No newline at end of file
.DS_Store
run.sh
\ No newline at end of file
This diff is collapsed.
Click to expand it.
praw-api.py
+
12
−
11
View file @
3f9a7f9b
import
praw
from
os
import
environ
# reddit = praw.Reddit(
# client_id="_cYY9dLkaIUy6I-p_yzXgw",
# client_secret="hO6SAqvDBRu7rIyei6C9uE-JscMPtA",
# user_agent="Trenddit/0.0.1",
# )
reddit
=
praw
.
Reddit
(
client_id
=
environ
.
get
(
'
C
lient_id
'
),
client_secret
=
environ
.
get
(
'
seceret_id
'
),
client_id
=
environ
.
get
(
'
C
LIENT_ID
'
),
client_secret
=
environ
.
get
(
'
SECRET_ID
'
),
user_agent
=
"
Trenddit/0.0.2
"
,
refresh_token
=
"
2350269160941-
a5OpOSu7rTd4TTVmIKDAtO2zQPcSag
"
,
password
=
environ
.
get
(
'
user_id
'
),
username
=
environ
.
get
(
'
password
'
),
refresh_token
=
'
2350269160941-
tBMkp2mTTMS_UUidLWbSwazOXzP4CA
'
,
username
=
environ
.
get
(
'
USER_ID
'
),
password
=
environ
.
get
(
'
PASSWORD
'
),
)
print
(
reddit
.
read_only
)
reddit
.
read_only
=
True
...
...
@@ -25,4 +23,7 @@ print(subreddit.display_name)
# Output: redditdev
print
(
subreddit
.
title
)
# Output: reddit development
print
(
subreddit
.
description
)
\ No newline at end of file
# print(subreddit.description)
for
submission
in
reddit
.
subreddit
(
"
canada
"
).
hot
(
limit
=
10
):
print
(
submission
.
title
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
reddit-oauth.py
+
8
−
3
View file @
3f9a7f9b
import
requests
from
os
import
environ
# note that CLIENT_ID refers to 'personal use script' and SECRET_TOKEN to 'token'
auth
=
requests
.
auth
.
HTTPBasicAuth
(
'
-jZtWxCPaO8z8h_fmhfhhw
'
,
'
DEzwCKBY-LjaMKrLCHHdkrGsc-HvCA
'
)
auth
=
requests
.
auth
.
HTTPBasicAuth
(
environ
.
get
(
'
CLIENT_ID
'
),
environ
.
get
(
'
SECRET_ID
'
))
print
(
environ
.
get
(
'
CLIENT_ID
'
))
# here we pass our login method (password), username, and password
data
=
{
'
grant_type
'
:
'
password
'
,
'
username
'
:
environ
.
get
(
'
user_id
'
),
'
password
'
:
environ
.
get
(
'
password
'
)}
'
username
'
:
environ
.
get
(
'
USER_ID
'
),
'
password
'
:
environ
.
get
(
'
PASSWORD
'
)}
# setup our header info, which gives reddit a brief description of our app
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
57
−
57
View file @
3f9a7f9b
asyncio
==3.4.3
CacheControl
==0.12.11
cachetools
==5.2.0
certifi
==2022.9.24
cffi
==1.15.1
charset-normalizer
==2.1.1
click
==8.1.3
cryptography
==38.0.3
firebase-admin
==6.0.1
Flask
==2.2.2
Flask-Cors
==3.0.10
gcloud
==0.17.0
google-api-core
==2.10.2
google-api-python-cli
e
nt
==2.65.0
google-auth
==2.14.1
google-auth-httplib2
==0.1.0
google-cloud-core
==2.3.2
google-cloud-firestore
==2.7.2
google-cloud-storage
==2.6.0
google-crc32c
==1.5.0
google-resumable-media
==2.4.0
googleapis-common-protos
==1.56.4
grpcio
==1.50.0
grpcio-status
==1.50.0
httplib2
==0.21.0
idna
==3.4
importlib-metadata
==5.0.0
itsdangerous
==2.1.2
Jinja2
==3.1.2
json2html
==1.3.0
jws
==0.1.3
MarkupSafe
==2.1.1
msgpack
==1.0.4
oauth2client
==3.0.0
praw
==7.6.0
prawcore
==2.3.0
proto-plus
==1.22.1
protobuf
==4.21.9
pyasn1
==0.4.8
pyasn1-modules
==0.2.8
pycparser
==2.21
pycryptodome
==3.4.3
PyJWT
==2.6.0
pyparsing
==3.0.9
Pyrebase
==3.0.27
python-jwt
==2.0.1
requests
==2.28.1
requests-toolbelt
==0.7.0
rsa
==4.9
simplejson
==3.17.6
six
==1.16.0
update-checker
==0.18.0
uritemplate
==4.1.1
urllib3
==1.26.12
websocket-client
==1.4.2
Werkzeug
==2.2.2
zipp
==3.10.0
asyncio
CacheControl
cachetools
certifi
cffi
charset-normalizer
click
cryptography
firebase-admin
Flask
Flask-Cors
gcloud
google-api-core
google-api-python-clint
google-auth
google-auth-httplib2
google-cloud-core
google-cloud-firestore
google-cloud-storage
google-crc32c
google-resumable-media
googleapis-common-protos
grpcio
grpcio-status
httplib2
idna
importlib-metadata
itsdangerous
Jinja2
json2html
jws
MarkupSafe
msgpack
oauth2client
praw
prawcore
proto-plus
protobuf
pyasn1
pyasn1-modules
pycparser
pycryptodome
PyJWT
pyparsing
Pyrebase
python-jwt
requests
requests-toolbelt
rsa
simplejson
six
update-checker
uritemplate
urllib3
websocket-client
Werkzeug
zipp
This diff is collapsed.
Click to expand it.
run.sh
+
8
−
1
View file @
3f9a7f9b
export
CLIENT_ID
=
'7dlaGED5g8Z9nqyuWifKqA'
export
SECRET_ID
=
'qLG8_LvLVlix4p8gfjMJ1LOyTOZ8pg'
export
USER_ID
=
'Varun@legend'
export
PASSWORD
=
'trenddit-dev'
source
./venv/bin/activate
pip
install
-r
requirements.txt
python3 application.py
-p
5000
\ No newline at end of file
# python3 application.py -p 500
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment