Check-in [aa105661b8]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | freecode-submit with minor adaptions for freshcode.club |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
aa105661b897e7edc01ef418cda27319 |
| User & Date: | mario 2014-07-29 23:53:30 |
Context
|
2014-07-29
| ||
| 23:54 | URL updating verified for function, also updates separate homepage and download fields now check-in: cf7b3c257a user: mario tags: trunk | |
| 23:53 | freecode-submit with minor adaptions for freshcode.club check-in: aa105661b8 user: mario tags: trunk | |
| 23:52 | freecode-submit 2.9 check-in: a7a69e19c8 user: mario tags: trunk | |
Changes
Changes to doc/fc-submit.
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
"Carry exception state when a session blows up."
def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
class FreecodeSession:
"Encapsulate the state of a Freecode API session."
| | | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
"Carry exception state when a session blows up."
def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
class FreecodeSession:
"Encapsulate the state of a Freecode API session."
server = "https://%s.freshcode.club/" % "api"
def __init__(self, auth=None, verbose=0, emit_enable=True):
"Initialize Freecode session credentials."
self.auth = auth
self.verbose = verbose
self.emit_enable = emit_enable
self.project = None
self.permalink = None
self.id = None
self.project_data = None
# If user didn't supply credentials, fetch from ~/.netrc
if not self.auth:
try:
credentials = netrc.netrc()
except netrc.NetrcParseError, e:
raise FreecodeSessionException("ill-formed .netrc: %s:%s %s" \
% (e.filename, e.lineno, e.msg))
except IOError, e:
raise FreecodeSessionException(("missing .netrc file %s" % \
str(e).split()[-1]))
ret = credentials.authenticators("freshcode")
if not ret:
raise FreecodeSessionException("no credentials for Freshcode")
_login, self.auth, _password = ret
def on_project(self, name):
"Select project by Freecode shortname."
if self.verbose:
print "Selecting project: %s" % name
self.project = name
|
| ︙ | ︙ | |||
169 170 171 172 173 174 175 |
if self.verbose:
print "URL list update for %s is: %s" % (self.project, urlassoc)
# First, get permalinks for all existing URLs
uquery = FreecodeSession.server + "projects/%s/urls.json?auth_code=%s" \
% (self.permalink, self.auth)
handle = urllib2.urlopen(uquery)
content = json.loads(handle.read())
| | < < < < < | < | < | | | < < < < < < < < < < < | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
if self.verbose:
print "URL list update for %s is: %s" % (self.project, urlassoc)
# First, get permalinks for all existing URLs
uquery = FreecodeSession.server + "projects/%s/urls.json?auth_code=%s" \
% (self.permalink, self.auth)
handle = urllib2.urlopen(uquery)
content = json.loads(handle.read())
permadict = content['urls']
# Just send the new dict over
self.edit_request("projects/%s/urls.json" % (self.permalink),
"PUSH",
{"urls" : dict(urlassoc)})
class FreecodeMetadataFactory:
"Factory class for producing Freecode records in JSON."
freecode_field_map = (
("Project", "P", "name"), # Project
("Summary", "S", "oneliner"), # Project
("Description", "D", "description"), # Project
("License-List", "L", "license_list"), # Project
|
| ︙ | ︙ |