forked from GauravKatare/FakeAndCatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend.py
49 lines (36 loc) · 1.1 KB
/
send.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import sys
import requests
import os
proxy = 'http://edcguest:edcguest@172.31.100.14:3128'
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy
import firebase_admin
from firebase_admin import credentials
from firebase_admin import storage
image_url ="gaurav.jpg"
cred = credentials.Certificate('kuchhbhi-b275f-firebase-adminsdk-qkdpu-d89833904b.json')
firebase_admin.initialize_app(cred, {
'storageBucket': 'kuchhbhi-b275f.appspot.com'
})
bucket = storage.bucket()
imageBlob = bucket.blob("/")
imagePath = "gaurav.jpg"
imageBlob = bucket.blob("gaurav.jpg")
imageBlob.upload_from_filename(imagePath)
# blob = bucket.blob('gaurav.jpg')
# outfile='C:\\Users\\blackturtle\\Envs\\tube\\hello.txt'
# with open(outfile, 'rb') as my_file:
# blob.upload_from_file(my_file)
#
# bucket = storage.bucket()
#
# image_data = requests.get(image_url).content
# blob = bucket.blob('new_cool_image.jpg')
# blob.upload_from_string(
# image_data,
# content_type='image/jpg'
# )
# print(blob.public_url)