• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

By Abhishek Ghosh February 20, 2015 8:28 am Updated on February 20, 2015

Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

Advertisement

Here is a Simple Python Script to Upload Files to OpenStack Swift, for Our Case HP Cloud CDN. Very easy to use from Mac or Linux Server. This is an expected thing to our regular readers whom are following our previous guides. We wanted to work with only Python Swift Client. That is the only near Error Free Tool so far.

 

What You Need To Know Before Using This Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

 

You need to read our previous guides :

 

  1. Upload to HP Cloud CDN Using OpenStack Swift Client
  2. WordPress W3TC Setup to Upload Files to HP Cloud CDN Using OpenStack Swift Client 

 

From those guides, you have to find the links to install and configure Python Swift Client. You must have that openrc.sh file imported in your .zshrc or .bashrc file. In other words, swift command must be working.

Advertisement

---

 

Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

 

It is a very simple file named upload.sh. Upon running the script, it will ask for the path (or file) you want to upload things from and the container name. After the work is done, it will give you the message with time stamp.

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
# –*– coding: utf–8 –*–
#
# Author : Dr. Abhishek Ghosh
# GNU GPL 3.0
# https://thecustomizewindows.com
#
echo “Script to copy source files/directories to OpenStack Swift Storage”
echo “Supply the source file/directory below:”
read target
echo “Supply the Swift Container Name Below:”
read container
echo ” “
swift upload $container $target
finish=date "+%Y-%m-%d-%H-%M-%S"
echo “Upload completed at ${finish}”

Yeah, quite basic; but that basic script was not available. As the bash is set for Python, it will not throw error, at least on OS X. To use it, run :

Vim
1
2
3
4
git clone https://github.com/AbhishekGhosh/OpenStack–Swift–Upload–Script.git
cd OpenStack–Swift–Upload–Script*
chmod +x upload.sh
sh upload.sh
Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

It will ask “Supply the source file/directory below:”. You will paste/type the full UNIX path like :

Vim
1
/Users/abhishekghosh/Desktop/cdn

and hit the Return / Enter Key. Then it will ask “Supply the container name below:”. You’ll type only the container name, like :

Vim
1
test

and hit the Return / Enter Key. For me, it gave output :

Vim
1
2
3
/Users/abhishekghosh/Desktop/cdn/.DS_Store
/Users/abhishekghosh/Desktop/cdn/OpenShift WordPress Multisite.png
Upload completed at 2015–01–31–02–45–13

You can omit No handlers could be found for logger “keystoneclient.httpclient” error. Thats not our fault.
Easy thing. But that is showing some light towards a plain web based tool, WordPress Plugin and many stuffs. Without sudo it is running. When OS X it is running, it should work fine for Linux, there is no UNIX Wheel Group.

 

Next Steps

 

Adding Meta Data. Most important.
Adding the function to copy static files from directory A to directory B. Then upload.
Adding the Auth System within the script.
Integrating with Original Swift Client.
Adding Colors.
Porting as WordPress Plugin.

Right now, it will crudely copy all. Programmatically it is important. By usage, you might not find very very useful. We will try to execute it via PHP. That will avoid installing the Junks.

The things are reminding me of the Lady who on her off time wrote a punch card to input data to a kind of mechanical machine.

Tagged With cdn file upload python , how to upload file to openstack swift via webpage , paperuri:(b4109fe7a261bc1479953abad1ac89fa) , python script to upload file , python scripting accesing Openstack file

This Article Has Been Shared 978 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)

  • Cloud Computing 3D Rendering And Scope In Film Industry

    Cloud Computing 3D Rendering Has Definite Scope in Film Industry which might alarm the Stars of tomorrow and relieve the Producers investing in the Films.

  • SaaS : Everything You Wanted To Know

    SaaS or Software as a Service is designed by the architecture to be used by the consumer. SaaS is the model oCloud which the general users mostly know to exist.

  • Cloud Computing Grown as There Was Real Demand From The Customers

    Cloud Computing grown as there was a clear cut demand from the consumer. Most users who cares for quality, actually went mad with the traditional web hosts. The crap graphics of cPanel, increasing bill for Virtual Private Server and Dedicated server, “your problem you will solve” type of mentality, usage of worst possible hardwares, all […]

  • Cloud Database : Migrating From Relational Database Model to NoSQL

    Cloud Database is more and being in use now than before. The question of migrating from relational database model to NoSQL Database is becoming more important.

  • Mobile Phone Camera Photography : Get The Best Result

    Mobile Phone Camera Photography is becoming an important matter to seriously consider for Digital Photography. We always take a Mobile Phone with us.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023
  • What is Vehicular Ad-Hoc Network? January 24, 2023
  • Difference Between Panel Light, COB Light, Track Light January 21, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Python Script to Upload Files to OpenStack Swift (HP Cloud CDN)," in The Customize Windows, February 20, 2015, January 30, 2023, https://thecustomizewindows.com/2015/02/python-script-to-upload-files-to-openstack-swift-hp-cloud-cdn/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT