SlideShare a Scribd company logo
Code transcript below, indents not here:
import sys
import json
import requests
import base64
# Firebase URL
firebase_url = "YOUR_FIREBASE_URL"
# Function to get the data from Firebase
def get_firebase_data(url):
response = requests.get(url)
data = json.loads(response.text)
return data
# Function to list all files and directories under a given directory
def list_directory(dir_path):
data = get_firebase_data(firebase_url + dir_path + ".json")
if data is not None:
for key in data.keys():
if key == "content":
print(dir_path + ": " + data[key])
else:
list_directory(dir_path + "/" + key)
# Function to create a new file with the given content
def create_file(file_path, content):
data = {"content": content}
response = requests.put(firebase_url + file_path + ".json", data=json.dumps(data))
# Function to create a new directory
def create_directory(dir_path):
data = {}
response = requests.put(firebase_url + dir_path + ".json", data=json.dumps(data))
# Function to remove a file or directory
def remove(path):
response = requests.delete(firebase_url + path + ".json")
# Function to export the file system structure in XML format
def export_xml():
root_data = get_firebase_data(firebase_url + ".json")
print("<root>")
for key in root_data.keys():
print("<" + key + ">")
export_directory(key)
print("</" + key + ">")
print("</root>")
# Function to export a directory and its contents in XML format
def export_directory(dir_path):
data = get_firebase_data(firebase_url + dir_path + ".json")
if data is not None:
for key in data.keys():
if key == "content":
content = data[key]
print("<file name='" + dir_path + "'>" + base64.b64encode(content.encode('utf-8')).decode('utf-
8') + "</file>")
else:
print("<directory name='" + key + "'>")
export_directory(dir_path + "/" + key)
print("</directory>")
# Parse the command-line arguments
args = sys.argv
command = args[1]
path = args[2]
# Execute the appropriate command
if command == "-ls":
list_directory(path)
elif command == "-create":
content = args[3]
create_file(path, content)
elif command == "-mkdir":
create_directory(path)
elif command == "-rmdir" or command == "-rm":
remove(path)
elif command == "-export":
export_xml()
Code transcript below- indents not here- import sys import json import.docx

More Related Content

Similar to Code transcript below- indents not here- import sys import json import.docx

Source Code for Dpilot
Source Code for Dpilot Source Code for Dpilot
Source Code for Dpilot
Nidhi Chauhan
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
Edit the script in to disable code which adds demonstration entries to.pdf
Edit the script in to disable code which adds demonstration entries to.pdfEdit the script in to disable code which adds demonstration entries to.pdf
Edit the script in to disable code which adds demonstration entries to.pdf
PeterM9sWhitej
 
SphinxSE with MySQL
SphinxSE with MySQLSphinxSE with MySQL
SphinxSE with MySQL
Ritesh Puthran
 
ThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or lessThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or less
Mayank Mohan Upadhyay
 
Android writing and reading from firebase
Android writing and reading from firebaseAndroid writing and reading from firebase
Android writing and reading from firebase
Osahon Gino Ediagbonya
 
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Hiroshi Shibamura
 
All you need to know about JavaScript Functions
All you need to know about JavaScript FunctionsAll you need to know about JavaScript Functions
All you need to know about JavaScript Functions
Oluwaleke Fakorede
 
テストデータどうしてますか?
テストデータどうしてますか?テストデータどうしてますか?
テストデータどうしてますか?
Yuki Shibazaki
 
C# Application program UNIT III
C# Application program UNIT IIIC# Application program UNIT III
C# Application program UNIT III
Minu Rajasekaran
 
Html indexed db
Html indexed dbHtml indexed db
Html indexed db
AbhishekMondal42
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"
Webmontag Berlin
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
Eric ShangKuan
 
Python - File operations & Data parsing
Python - File operations & Data parsingPython - File operations & Data parsing
Python - File operations & Data parsing
Felix Z. Hoffmann
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
kchodorow
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component plugin
searchbox-com
 
Scala Slick-2
Scala Slick-2Scala Slick-2
Scala Slick-2
Artem Vlasenko
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptx
rani marri
 
Declarative Data Modeling in Python
Declarative Data Modeling in PythonDeclarative Data Modeling in Python
Declarative Data Modeling in Python
Joshua Forman
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012
Yaqi Zhao
 

Similar to Code transcript below- indents not here- import sys import json import.docx (20)

Source Code for Dpilot
Source Code for Dpilot Source Code for Dpilot
Source Code for Dpilot
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
 
Edit the script in to disable code which adds demonstration entries to.pdf
Edit the script in to disable code which adds demonstration entries to.pdfEdit the script in to disable code which adds demonstration entries to.pdf
Edit the script in to disable code which adds demonstration entries to.pdf
 
SphinxSE with MySQL
SphinxSE with MySQLSphinxSE with MySQL
SphinxSE with MySQL
 
ThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or lessThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or less
 
Android writing and reading from firebase
Android writing and reading from firebaseAndroid writing and reading from firebase
Android writing and reading from firebase
 
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
 
All you need to know about JavaScript Functions
All you need to know about JavaScript FunctionsAll you need to know about JavaScript Functions
All you need to know about JavaScript Functions
 
テストデータどうしてますか?
テストデータどうしてますか?テストデータどうしてますか?
テストデータどうしてますか?
 
C# Application program UNIT III
C# Application program UNIT IIIC# Application program UNIT III
C# Application program UNIT III
 
Html indexed db
Html indexed dbHtml indexed db
Html indexed db
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
Python - File operations & Data parsing
Python - File operations & Data parsingPython - File operations & Data parsing
Python - File operations & Data parsing
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component plugin
 
Scala Slick-2
Scala Slick-2Scala Slick-2
Scala Slick-2
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptx
 
Declarative Data Modeling in Python
Declarative Data Modeling in PythonDeclarative Data Modeling in Python
Declarative Data Modeling in Python
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012
 

More from Joe7Y7Nolany

Compare and contrast the two images and record your responses below- f.docx
Compare and contrast the two images and record your responses below- f.docxCompare and contrast the two images and record your responses below- f.docx
Compare and contrast the two images and record your responses below- f.docx
Joe7Y7Nolany
 
Compute net cash provided by operating activities using the indirect m.docx
Compute net cash provided by operating activities using the indirect m.docxCompute net cash provided by operating activities using the indirect m.docx
Compute net cash provided by operating activities using the indirect m.docx
Joe7Y7Nolany
 
Complete the following paragraph to describe the diversity that exists.docx
Complete the following paragraph to describe the diversity that exists.docxComplete the following paragraph to describe the diversity that exists.docx
Complete the following paragraph to describe the diversity that exists.docx
Joe7Y7Nolany
 
Complete the following paragraph to describe soil profiles- Soil profi.docx
Complete the following paragraph to describe soil profiles- Soil profi.docxComplete the following paragraph to describe soil profiles- Soil profi.docx
Complete the following paragraph to describe soil profiles- Soil profi.docx
Joe7Y7Nolany
 
Complete the following statements- 1- Mature red blood cells are also.docx
Complete the following statements- 1- Mature red blood cells are also.docxComplete the following statements- 1- Mature red blood cells are also.docx
Complete the following statements- 1- Mature red blood cells are also.docx
Joe7Y7Nolany
 
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docxCommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
Joe7Y7Nolany
 
Cold climate species in the worlds extensive northern land masses Slow.docx
Cold climate species in the worlds extensive northern land masses Slow.docxCold climate species in the worlds extensive northern land masses Slow.docx
Cold climate species in the worlds extensive northern land masses Slow.docx
Joe7Y7Nolany
 
Companies that use IFRS- a- Are allowed to report property- plant- and.docx
Companies that use IFRS- a- Are allowed to report property- plant- and.docxCompanies that use IFRS- a- Are allowed to report property- plant- and.docx
Companies that use IFRS- a- Are allowed to report property- plant- and.docx
Joe7Y7Nolany
 
Comments in PHPi )Single Line Comments Comments that do not exceed the.docx
Comments in PHPi )Single Line Comments Comments that do not exceed the.docxComments in PHPi )Single Line Comments Comments that do not exceed the.docx
Comments in PHPi )Single Line Comments Comments that do not exceed the.docx
Joe7Y7Nolany
 
Climate has a direct influence on the key eclosystem processes of and.docx
Climate has a direct influence on the key eclosystem processes of and.docxClimate has a direct influence on the key eclosystem processes of and.docx
Climate has a direct influence on the key eclosystem processes of and.docx
Joe7Y7Nolany
 
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docxCLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
Joe7Y7Nolany
 
Circle the correct answer- 1- The teclnique of using a group of disks.docx
Circle the correct answer- 1- The teclnique of using a group of disks.docxCircle the correct answer- 1- The teclnique of using a group of disks.docx
Circle the correct answer- 1- The teclnique of using a group of disks.docx
Joe7Y7Nolany
 
complete step give answer Three different methods of teaching English.docx
complete step give answer  Three different methods of teaching English.docxcomplete step give answer  Three different methods of teaching English.docx
complete step give answer Three different methods of teaching English.docx
Joe7Y7Nolany
 
Class abstraction means--- Putting all data fields private and creatin.docx
Class abstraction means--- Putting all data fields private and creatin.docxClass abstraction means--- Putting all data fields private and creatin.docx
Class abstraction means--- Putting all data fields private and creatin.docx
Joe7Y7Nolany
 
Consider the Titanic dataset- summarized according to economic status.docx
Consider the Titanic dataset- summarized according to economic status.docxConsider the Titanic dataset- summarized according to economic status.docx
Consider the Titanic dataset- summarized according to economic status.docx
Joe7Y7Nolany
 
Classify each of the following based on the macroeconomic definitions.docx
Classify each of the following based on the macroeconomic definitions.docxClassify each of the following based on the macroeconomic definitions.docx
Classify each of the following based on the macroeconomic definitions.docx
Joe7Y7Nolany
 
Consider the relationship between a parasite and its host- There is pr (1).docx
Consider the relationship between a parasite and its host- There is pr (1).docxConsider the relationship between a parasite and its host- There is pr (1).docx
Consider the relationship between a parasite and its host- There is pr (1).docx
Joe7Y7Nolany
 
Consider the investment projects in the table below- all of which have.docx
Consider the investment projects in the table below- all of which have.docxConsider the investment projects in the table below- all of which have.docx
Consider the investment projects in the table below- all of which have.docx
Joe7Y7Nolany
 
Consider the following two independent investment opportunities that a (1).docx
Consider the following two independent investment opportunities that a (1).docxConsider the following two independent investment opportunities that a (1).docx
Consider the following two independent investment opportunities that a (1).docx
Joe7Y7Nolany
 
Consider the following code- inchuding the initial pareet process- how.docx
Consider the following code- inchuding the initial pareet process- how.docxConsider the following code- inchuding the initial pareet process- how.docx
Consider the following code- inchuding the initial pareet process- how.docx
Joe7Y7Nolany
 

More from Joe7Y7Nolany (20)

Compare and contrast the two images and record your responses below- f.docx
Compare and contrast the two images and record your responses below- f.docxCompare and contrast the two images and record your responses below- f.docx
Compare and contrast the two images and record your responses below- f.docx
 
Compute net cash provided by operating activities using the indirect m.docx
Compute net cash provided by operating activities using the indirect m.docxCompute net cash provided by operating activities using the indirect m.docx
Compute net cash provided by operating activities using the indirect m.docx
 
Complete the following paragraph to describe the diversity that exists.docx
Complete the following paragraph to describe the diversity that exists.docxComplete the following paragraph to describe the diversity that exists.docx
Complete the following paragraph to describe the diversity that exists.docx
 
Complete the following paragraph to describe soil profiles- Soil profi.docx
Complete the following paragraph to describe soil profiles- Soil profi.docxComplete the following paragraph to describe soil profiles- Soil profi.docx
Complete the following paragraph to describe soil profiles- Soil profi.docx
 
Complete the following statements- 1- Mature red blood cells are also.docx
Complete the following statements- 1- Mature red blood cells are also.docxComplete the following statements- 1- Mature red blood cells are also.docx
Complete the following statements- 1- Mature red blood cells are also.docx
 
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docxCommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
CommonElements- You are given three sorted sequences A-B-C of $n--2$-.docx
 
Cold climate species in the worlds extensive northern land masses Slow.docx
Cold climate species in the worlds extensive northern land masses Slow.docxCold climate species in the worlds extensive northern land masses Slow.docx
Cold climate species in the worlds extensive northern land masses Slow.docx
 
Companies that use IFRS- a- Are allowed to report property- plant- and.docx
Companies that use IFRS- a- Are allowed to report property- plant- and.docxCompanies that use IFRS- a- Are allowed to report property- plant- and.docx
Companies that use IFRS- a- Are allowed to report property- plant- and.docx
 
Comments in PHPi )Single Line Comments Comments that do not exceed the.docx
Comments in PHPi )Single Line Comments Comments that do not exceed the.docxComments in PHPi )Single Line Comments Comments that do not exceed the.docx
Comments in PHPi )Single Line Comments Comments that do not exceed the.docx
 
Climate has a direct influence on the key eclosystem processes of and.docx
Climate has a direct influence on the key eclosystem processes of and.docxClimate has a direct influence on the key eclosystem processes of and.docx
Climate has a direct influence on the key eclosystem processes of and.docx
 
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docxCLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
CLINICAL QUESTIONS 1-List the nursing interventions for clients with l.docx
 
Circle the correct answer- 1- The teclnique of using a group of disks.docx
Circle the correct answer- 1- The teclnique of using a group of disks.docxCircle the correct answer- 1- The teclnique of using a group of disks.docx
Circle the correct answer- 1- The teclnique of using a group of disks.docx
 
complete step give answer Three different methods of teaching English.docx
complete step give answer  Three different methods of teaching English.docxcomplete step give answer  Three different methods of teaching English.docx
complete step give answer Three different methods of teaching English.docx
 
Class abstraction means--- Putting all data fields private and creatin.docx
Class abstraction means--- Putting all data fields private and creatin.docxClass abstraction means--- Putting all data fields private and creatin.docx
Class abstraction means--- Putting all data fields private and creatin.docx
 
Consider the Titanic dataset- summarized according to economic status.docx
Consider the Titanic dataset- summarized according to economic status.docxConsider the Titanic dataset- summarized according to economic status.docx
Consider the Titanic dataset- summarized according to economic status.docx
 
Classify each of the following based on the macroeconomic definitions.docx
Classify each of the following based on the macroeconomic definitions.docxClassify each of the following based on the macroeconomic definitions.docx
Classify each of the following based on the macroeconomic definitions.docx
 
Consider the relationship between a parasite and its host- There is pr (1).docx
Consider the relationship between a parasite and its host- There is pr (1).docxConsider the relationship between a parasite and its host- There is pr (1).docx
Consider the relationship between a parasite and its host- There is pr (1).docx
 
Consider the investment projects in the table below- all of which have.docx
Consider the investment projects in the table below- all of which have.docxConsider the investment projects in the table below- all of which have.docx
Consider the investment projects in the table below- all of which have.docx
 
Consider the following two independent investment opportunities that a (1).docx
Consider the following two independent investment opportunities that a (1).docxConsider the following two independent investment opportunities that a (1).docx
Consider the following two independent investment opportunities that a (1).docx
 
Consider the following code- inchuding the initial pareet process- how.docx
Consider the following code- inchuding the initial pareet process- how.docxConsider the following code- inchuding the initial pareet process- how.docx
Consider the following code- inchuding the initial pareet process- how.docx
 

Recently uploaded

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 

Recently uploaded (20)

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 

Code transcript below- indents not here- import sys import json import.docx

  • 1. Code transcript below, indents not here: import sys import json import requests import base64 # Firebase URL firebase_url = "YOUR_FIREBASE_URL" # Function to get the data from Firebase def get_firebase_data(url): response = requests.get(url) data = json.loads(response.text) return data # Function to list all files and directories under a given directory def list_directory(dir_path): data = get_firebase_data(firebase_url + dir_path + ".json") if data is not None: for key in data.keys(): if key == "content": print(dir_path + ": " + data[key]) else: list_directory(dir_path + "/" + key) # Function to create a new file with the given content def create_file(file_path, content):
  • 2. data = {"content": content} response = requests.put(firebase_url + file_path + ".json", data=json.dumps(data)) # Function to create a new directory def create_directory(dir_path): data = {} response = requests.put(firebase_url + dir_path + ".json", data=json.dumps(data)) # Function to remove a file or directory def remove(path): response = requests.delete(firebase_url + path + ".json") # Function to export the file system structure in XML format def export_xml(): root_data = get_firebase_data(firebase_url + ".json") print("<root>") for key in root_data.keys(): print("<" + key + ">") export_directory(key) print("</" + key + ">") print("</root>") # Function to export a directory and its contents in XML format def export_directory(dir_path): data = get_firebase_data(firebase_url + dir_path + ".json") if data is not None: for key in data.keys():
  • 3. if key == "content": content = data[key] print("<file name='" + dir_path + "'>" + base64.b64encode(content.encode('utf-8')).decode('utf- 8') + "</file>") else: print("<directory name='" + key + "'>") export_directory(dir_path + "/" + key) print("</directory>") # Parse the command-line arguments args = sys.argv command = args[1] path = args[2] # Execute the appropriate command if command == "-ls": list_directory(path) elif command == "-create": content = args[3] create_file(path, content) elif command == "-mkdir": create_directory(path) elif command == "-rmdir" or command == "-rm": remove(path) elif command == "-export": export_xml()