Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
c7d74333
Commit
c7d74333
authored
May 28, 2011
by
gcode@loowis.durge.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added getinfo function to HTTPFS (returns HTTP headers)
parent
82887d81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
fs/httpfs.py
+11
-0
No files found.
fs/httpfs.py
View file @
c7d74333
...
@@ -9,6 +9,7 @@ from fs.base import FS
...
@@ -9,6 +9,7 @@ from fs.base import FS
from
fs.path
import
normpath
from
fs.path
import
normpath
from
fs.errors
import
ResourceNotFoundError
,
UnsupportedError
from
fs.errors
import
ResourceNotFoundError
,
UnsupportedError
from
urllib2
import
urlopen
,
URLError
from
urllib2
import
urlopen
,
URLError
from
datetime
import
datetime
from
fs.filelike
import
FileWrapper
from
fs.filelike
import
FileWrapper
class
HTTPFS
(
FS
):
class
HTTPFS
(
FS
):
...
@@ -79,3 +80,13 @@ class HTTPFS(FS):
...
@@ -79,3 +80,13 @@ class HTTPFS(FS):
dirs_only
=
False
,
dirs_only
=
False
,
files_only
=
False
):
files_only
=
False
):
return
[]
return
[]
def
getinfo
(
self
,
path
):
url
=
self
.
_make_url
(
path
)
info
=
urlopen
(
url
)
.
info
()
.
dict
if
'content-length'
in
info
:
info
[
'size'
]
=
info
[
'content-length'
]
if
'last-modified'
in
info
:
info
[
'modified_time'
]
=
datetime
.
strptime
(
info
[
'last-modified'
],
"
%
a,
%
d
%
b
%
Y
%
H:
%
M:
%
S
%
Z"
)
return
info
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment