├── .gitignore ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── neocities ├── __init__.py ├── neocities.py └── neocli.py ├── setup.py └── tests ├── fixtures ├── cat.png └── gpl.html └── test_neocities.py /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | \#*\# 3 | .swp 4 | 5 | __pycache__/ 6 | *.py[cod] 7 | dist 8 | *.egg-info -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | MAINTAINER AJ Bowen 3 | 4 | RUN mkdir /src 5 | COPY . /src 6 | WORKDIR /src 7 | RUN pip install --upgrade pip 8 | RUN pip install --upgrade . 9 | ENTRYPOINT ["neocities"] 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX=/usr 2 | 3 | all: 4 | @echo "Run 'make test' to run unit tests" 5 | @echo "Run 'make install' to install python-espeak for user $(USER)" 6 | @echo "Run 'make global-install' as root to install python-espeak for all users" 7 | @echo "Run 'make uninstall' to uninstall the package" 8 | 9 | install: 10 | python setup.py install --user 11 | 12 | global-install: 13 | python setup.py install 14 | 15 | uninstall: 16 | pip uninstall neocities 17 | 18 | # Remember to set NEOCITIES_USER and NEOCITIES_PASS before running tests 19 | test: 20 | python -m unittest discover -s tests/ 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python-neocities - Python API for NeoCities.org 2 | 3 | python-neocities is a Python wrapper of the NeoCities.org REST API. 4 | 5 | NeoCities.org is a FLOSS service which offers 20 Megabytes of gratis 6 | and ad-free hosting inspired by GeoCities. I really liked their approach so 7 | I decided to contribute this little API. 8 | 9 | To install it, type `python setup.py install` or `make install`. 10 | 11 | The unit tests rely on having a NeoCities.org account. To run them, type 12 | 13 | ```bash 14 | NEOCITIES_USER=user NEOCITIES_PASS=pass make test 15 | ``` 16 | 17 | But then again, I wouldn't recommend running them at all since they might make 18 | you seem suspicious to NC's admins and the API is simple enough. 19 | 20 | ## Usage 21 | 22 | First, you must initialize a NeoCities object with 23 | 24 | ```python 25 | import neocities 26 | 27 | nc = neocities.NeoCities('username', 'password') 28 | ``` 29 | 30 | Or you can initialize a NeoCities object using an API key with 31 | 32 | ```python 33 | import neocities 34 | 35 | nc = neocities.NeoCities(api_key='NEOCITIES_API_KEY') 36 | ``` 37 | 38 | (Passing a valid username and password, or API key, is not necessary if you are only going 39 | to use the `info` call) 40 | 41 | After you've done that, you can query NeoCities for information about a 42 | specific site with: 43 | 44 | ```python 45 | response = nc.info('sitename') 46 | ``` 47 | 48 | If you have provided correct login credentials, you can also query NeoCities 49 | for your own site's info with 50 | 51 | ```python 52 | response = nc.info() 53 | ``` 54 | 55 | You can upload files with 56 | 57 | ```python 58 | nc.upload(('name_on_disk', 'name_on_server'), ...) 59 | ``` 60 | 61 | Where `name_on_server` is the name you want the file to have on the NeoCities 62 | server and `name_on_disk` is the name (path) of the file on your disk. 63 | 64 | You can delete a file remotely with 65 | 66 | ```python 67 | nc.delete('filename1', ...) 68 | ``` 69 | 70 | To make sure you are not doing something wrong, the `InvalidRequestError` 71 | exception will be fired when you do. It has a `status_code` attribute which 72 | contains the status code returned by your request. For a list of status codes 73 | (useful to debug your requests), check out 74 | [this Wikipedia page](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). 75 | -------------------------------------------------------------------------------- /neocities/__init__.py: -------------------------------------------------------------------------------- 1 | from .neocities import NeoCities 2 | from .neocli import cli 3 | -------------------------------------------------------------------------------- /neocities/neocities.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | 4 | class NeoCities: 5 | api_key = None 6 | def __init__(self, username=None, password=None, api_key=None, options={}): 7 | self.auth = (username, password) 8 | if api_key: 9 | self.api_key = api_key 10 | self.options = options 11 | self.url = options.get('url', 'https://neocities.org') 12 | 13 | def info(self, site_name=''): 14 | """ 15 | Request info for a neocities site (does not require authentication) 16 | 17 | Parameters 18 | ---------- 19 | site_name : str 20 | The name of the site 21 | 22 | Returns 23 | ------- 24 | request : dict 25 | A JSON-decoded request 26 | 27 | """ 28 | if site_name: 29 | args = {'sitename': site_name} 30 | else: 31 | args = None 32 | if self.api_key: 33 | response = requests.get(self._request_url('info'), params=args, headers={'Authorization':'Bearer '+self.api_key}) 34 | else: 35 | response = requests.get(self._request_url('info'), auth=self.auth, params=args) 36 | return self._decode(response) 37 | 38 | def listitems(self, site_name=''): 39 | """ 40 | Request file listing for a neocities site (does not require authentication). 41 | 42 | Parameters 43 | ---------- 44 | site_name : str 45 | The name of the site 46 | 47 | Returns 48 | ------- 49 | request : list of dicts 50 | A JSON-decoded request 51 | 52 | """ 53 | args = {'sitename': site_name} if site_name else None 54 | if self.api_key: 55 | response = requests.get(self._request_url('list'), params=args, headers={'Authorization':'Bearer '+self.api_key}) 56 | else: 57 | response = requests.get(self._request_url('list'), auth=self.auth, params=args) 58 | return self._decode(response) 59 | 60 | def delete(self, *filenames): 61 | """ 62 | Delete files from a NeoCities site 63 | 64 | Parameters 65 | ---------- 66 | filenames : *str 67 | The names of the files to be deleted 68 | 69 | Returns 70 | ------- 71 | request : dict 72 | A JSON-decoded request 73 | 74 | """ 75 | args = {'filenames[]': []} 76 | for i in filenames: 77 | args['filenames[]'].append(i) 78 | if self.api_key: 79 | response = requests.get(self._request_url('delete'), data=args, headers={'Authorization':'Bearer '+self.api_key}) 80 | else: 81 | response = requests.post(self._request_url('delete'), auth=self.auth, data=args) 82 | return self._decode(response) 83 | 84 | def upload(self, *filenames): 85 | """ 86 | Upload files to a NeoCities site 87 | 88 | Parameters 89 | ---------- 90 | filenames: *tuple (str, str) 91 | The names of the files to be uploaded in the format 92 | (name_on_disk, name_on_server) 93 | Note: name_on_server must include the file extension. 94 | 95 | Returns 96 | ------- 97 | request : dict 98 | A JSON-decoded request 99 | 100 | """ 101 | 102 | # NeoCities API expects a dict in the following format: 103 | # { name_on_server: } 104 | args = {pair[1]: open(pair[0], 'rb') for pair in filenames} 105 | if self.api_key: 106 | response = requests.post(self._request_url('upload'), files=args, headers={'Authorization':'Bearer '+self.api_key}) 107 | else: 108 | response = requests.post(self._request_url('upload'), auth=self.auth, files=args) 109 | return self._decode(response) 110 | 111 | def _request_url(self, method): 112 | return "{0}/api/{1}".format(self.url, method) 113 | 114 | def _decode(self, response): 115 | if response.status_code != 200: 116 | print(response.__dict__) 117 | raise NeoCities.InvalidRequestError(response.status_code, response._content) 118 | else: 119 | return response.json() 120 | 121 | class InvalidRequestError(Exception): 122 | """ 123 | Exception for signalling a request different than 200 OK 124 | """ 125 | def __init__(self, status_code, reason=None): 126 | self.status_code = status_code 127 | self.reason = reason 128 | 129 | def __str__(self): 130 | return "Request returned status code {}: {}".format(self.status_code, self.reason) 131 | -------------------------------------------------------------------------------- /neocities/neocli.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import neocities 3 | import requests 4 | import os 5 | import click 6 | from tabulate import tabulate 7 | import shutil 8 | 9 | CONTEXT_SETTINGS = dict( 10 | help_option_names=["-h", "--help"], token_normalize_func=lambda x: x.lower() 11 | ) 12 | 13 | supExt = [ 14 | ".html", 15 | ".htm", 16 | ".jpg", 17 | ".png", 18 | ".gif", 19 | ".svg", 20 | ".ico", 21 | ".md", 22 | ".markdown", 23 | ".js", 24 | ".json", 25 | ".geojson", 26 | ".css", 27 | ".txt", 28 | ".text", 29 | ".csv", 30 | ".tsv", 31 | ".xml", 32 | ".eot", 33 | ".ttf", 34 | ".woff", 35 | ".woff2", 36 | ".mid", 37 | ".midi", 38 | ] 39 | 40 | 41 | @click.group(context_settings=CONTEXT_SETTINGS) 42 | def cli(): 43 | pass 44 | 45 | 46 | @cli.command() 47 | @click.argument("site", required=False) 48 | def info(site): 49 | """Display information about a NeoCities site.""" 50 | if site: 51 | site = site.rstrip(".neocities.org") 52 | response = nc.info(site) 53 | else: 54 | response = nc.info() 55 | if "info" in response: 56 | response = response["info"] 57 | else: 58 | print(response) 59 | return 60 | rows = [[key, response[key]] for key in response] 61 | table = tabulate(rows) 62 | print(table) 63 | 64 | 65 | @cli.command() 66 | @click.argument("source", required=True, type=click.File("rb")) 67 | @click.argument("destination", required=False) 68 | def upload(source, destination): 69 | """Upload one or more files to a NeoCities site. 70 | Source refers to a local file. 71 | Destination refers to the remote file name and location. 72 | """ 73 | if destination and "." not in destination: 74 | click.echo("Invalid target; specify a target path file extension.") 75 | return 1 76 | nc.upload((source.name, destination if destination else source.name)) 77 | 78 | 79 | @cli.command() 80 | @click.argument("filenames", required=True, nargs=-1) 81 | def delete(filenames): 82 | """Delete one or more files from a NeoCities site.""" 83 | nc.delete(filenames) 84 | 85 | 86 | @cli.command() 87 | @click.argument("site", required=False) 88 | def list(site): 89 | """List files of a NeoCities site.""" 90 | if site: 91 | site = site.rstrip(".neocities.org") 92 | response = nc.listitems(site) 93 | else: 94 | response = nc.listitems() 95 | 96 | if "files" in response: 97 | files = response["files"] 98 | else: 99 | print(response) 100 | return 101 | table = tabulate(files, "keys") 102 | 103 | print(table) 104 | 105 | 106 | @cli.command() 107 | @click.argument("dirc", required=True) 108 | def push(dirc): 109 | """Push recursively directory to NeoCities site""" 110 | files = [] 111 | for root, dirs, dirfiles, in os.walk(dirc): 112 | for name in dirfiles: 113 | files.append((os.path.join(root, name), 114 | os.path.relpath(os.path.join(root, name), dirc))) 115 | for filename, dest in files: 116 | if os.path.splitext(filename)[1].lower() in supExt: 117 | nc.upload((filename, dest)) 118 | 119 | 120 | def main(): 121 | username = os.environ.get("NEOCITIES_USER") 122 | password = os.environ.get("NEOCITIES_PASS") 123 | api_key = os.environ.get("NEOCITIES_API_KEY") 124 | global nc 125 | nc = neocities.NeoCities(username, password, api_key) 126 | cli(obj={}) 127 | 128 | 129 | if __name__ == "__main__": 130 | main() 131 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from setuptools import setup, find_packages 4 | 5 | setup(name='neocities', 6 | version='0.1.0', 7 | description='Python API for NeoCities.org', 8 | classifiers=[ 9 | 'Topic :: Internet' 10 | 'Operating System :: OS Independent', 11 | 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)' 12 | ], 13 | license='LGPLv3', 14 | package_dir={'neocities': 'neocities'}, 15 | install_requires=['requests', 16 | 'click', 17 | 'tabulate'], 18 | packages=find_packages('.'), 19 | entry_points="""\ 20 | [console_scripts] 21 | neocities = neocities.neocli:main 22 | """, 23 | ) 24 | -------------------------------------------------------------------------------- /tests/fixtures/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neocities/python-neocities/213b1971110e5124bbb92953bd9f50ceb8c0ae08/tests/fixtures/cat.png -------------------------------------------------------------------------------- /tests/fixtures/gpl.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | The GNU General Public License v3.0 18 | - GNU Project - Free Software Foundation 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 | 45 | 46 |
47 |
48 |
49 | 51 | 52 |
53 |
54 |
55 | 56 |
57 |

58 | English [en]   59 | العربية [ar]   60 | català [ca]   61 | Deutsch [de]   62 | français [fr]   63 | 日本語 [ja]   64 | русский [ru]   65 |

66 |
67 | 68 | 69 | 70 | 71 | 72 | 100 | 101 | 114 | 115 | 116 |
117 | 118 | 119 |

GNU General Public License

120 | 121 | 122 | 123 | 147 | 148 |
149 | 150 | 153 |
154 |

GNU GENERAL PUBLIC LICENSE

155 |

Version 3, 29 June 2007

156 | 157 |

Copyright © 2007 Free Software Foundation, Inc. 158 | <http://fsf.org/>

159 | Everyone is permitted to copy and distribute verbatim copies 160 | of this license document, but changing it is not allowed.

161 | 162 |

Preamble

163 | 164 |

The GNU General Public License is a free, copyleft license for 165 | software and other kinds of works.

166 | 167 |

The licenses for most software and other practical works are designed 168 | to take away your freedom to share and change the works. By contrast, 169 | the GNU General Public License is intended to guarantee your freedom to 170 | share and change all versions of a program--to make sure it remains free 171 | software for all its users. We, the Free Software Foundation, use the 172 | GNU General Public License for most of our software; it applies also to 173 | any other work released this way by its authors. You can apply it to 174 | your programs, too.

175 | 176 |

When we speak of free software, we are referring to freedom, not 177 | price. Our General Public Licenses are designed to make sure that you 178 | have the freedom to distribute copies of free software (and charge for 179 | them if you wish), that you receive source code or can get it if you 180 | want it, that you can change the software or use pieces of it in new 181 | free programs, and that you know you can do these things.

182 | 183 |

To protect your rights, we need to prevent others from denying you 184 | these rights or asking you to surrender the rights. Therefore, you have 185 | certain responsibilities if you distribute copies of the software, or if 186 | you modify it: responsibilities to respect the freedom of others.

187 | 188 |

For example, if you distribute copies of such a program, whether 189 | gratis or for a fee, you must pass on to the recipients the same 190 | freedoms that you received. You must make sure that they, too, receive 191 | or can get the source code. And you must show them these terms so they 192 | know their rights.

193 | 194 |

Developers that use the GNU GPL protect your rights with two steps: 195 | (1) assert copyright on the software, and (2) offer you this License 196 | giving you legal permission to copy, distribute and/or modify it.

197 | 198 |

For the developers' and authors' protection, the GPL clearly explains 199 | that there is no warranty for this free software. For both users' and 200 | authors' sake, the GPL requires that modified versions be marked as 201 | changed, so that their problems will not be attributed erroneously to 202 | authors of previous versions.

203 | 204 |

Some devices are designed to deny users access to install or run 205 | modified versions of the software inside them, although the manufacturer 206 | can do so. This is fundamentally incompatible with the aim of 207 | protecting users' freedom to change the software. The systematic 208 | pattern of such abuse occurs in the area of products for individuals to 209 | use, which is precisely where it is most unacceptable. Therefore, we 210 | have designed this version of the GPL to prohibit the practice for those 211 | products. If such problems arise substantially in other domains, we 212 | stand ready to extend this provision to those domains in future versions 213 | of the GPL, as needed to protect the freedom of users.

214 | 215 |

Finally, every program is threatened constantly by software patents. 216 | States should not allow patents to restrict development and use of 217 | software on general-purpose computers, but in those that do, we wish to 218 | avoid the special danger that patents applied to a free program could 219 | make it effectively proprietary. To prevent this, the GPL assures that 220 | patents cannot be used to render the program non-free.

221 | 222 |

The precise terms and conditions for copying, distribution and 223 | modification follow.

224 | 225 |

TERMS AND CONDITIONS

226 | 227 |

0. Definitions.

228 | 229 |

“This License” refers to version 3 of the GNU General Public License.

230 | 231 |

“Copyright” also means copyright-like laws that apply to other kinds of 232 | works, such as semiconductor masks.

233 | 234 |

“The Program” refers to any copyrightable work licensed under this 235 | License. Each licensee is addressed as “you”. “Licensees” and 236 | “recipients” may be individuals or organizations.

237 | 238 |

To “modify” a work means to copy from or adapt all or part of the work 239 | in a fashion requiring copyright permission, other than the making of an 240 | exact copy. The resulting work is called a “modified version” of the 241 | earlier work or a work “based on” the earlier work.

242 | 243 |

A “covered work” means either the unmodified Program or a work based 244 | on the Program.

245 | 246 |

To “propagate” a work means to do anything with it that, without 247 | permission, would make you directly or secondarily liable for 248 | infringement under applicable copyright law, except executing it on a 249 | computer or modifying a private copy. Propagation includes copying, 250 | distribution (with or without modification), making available to the 251 | public, and in some countries other activities as well.

252 | 253 |

To “convey” a work means any kind of propagation that enables other 254 | parties to make or receive copies. Mere interaction with a user through 255 | a computer network, with no transfer of a copy, is not conveying.

256 | 257 |

An interactive user interface displays “Appropriate Legal Notices” 258 | to the extent that it includes a convenient and prominently visible 259 | feature that (1) displays an appropriate copyright notice, and (2) 260 | tells the user that there is no warranty for the work (except to the 261 | extent that warranties are provided), that licensees may convey the 262 | work under this License, and how to view a copy of this License. If 263 | the interface presents a list of user commands or options, such as a 264 | menu, a prominent item in the list meets this criterion.

265 | 266 |

1. Source Code.

267 | 268 |

The “source code” for a work means the preferred form of the work 269 | for making modifications to it. “Object code” means any non-source 270 | form of a work.

271 | 272 |

A “Standard Interface” means an interface that either is an official 273 | standard defined by a recognized standards body, or, in the case of 274 | interfaces specified for a particular programming language, one that 275 | is widely used among developers working in that language.

276 | 277 |

The “System Libraries” of an executable work include anything, other 278 | than the work as a whole, that (a) is included in the normal form of 279 | packaging a Major Component, but which is not part of that Major 280 | Component, and (b) serves only to enable use of the work with that 281 | Major Component, or to implement a Standard Interface for which an 282 | implementation is available to the public in source code form. A 283 | “Major Component”, in this context, means a major essential component 284 | (kernel, window system, and so on) of the specific operating system 285 | (if any) on which the executable work runs, or a compiler used to 286 | produce the work, or an object code interpreter used to run it.

287 | 288 |

The “Corresponding Source” for a work in object code form means all 289 | the source code needed to generate, install, and (for an executable 290 | work) run the object code and to modify the work, including scripts to 291 | control those activities. However, it does not include the work's 292 | System Libraries, or general-purpose tools or generally available free 293 | programs which are used unmodified in performing those activities but 294 | which are not part of the work. For example, Corresponding Source 295 | includes interface definition files associated with source files for 296 | the work, and the source code for shared libraries and dynamically 297 | linked subprograms that the work is specifically designed to require, 298 | such as by intimate data communication or control flow between those 299 | subprograms and other parts of the work.

300 | 301 |

The Corresponding Source need not include anything that users 302 | can regenerate automatically from other parts of the Corresponding 303 | Source.

304 | 305 |

The Corresponding Source for a work in source code form is that 306 | same work.

307 | 308 |

2. Basic Permissions.

309 | 310 |

All rights granted under this License are granted for the term of 311 | copyright on the Program, and are irrevocable provided the stated 312 | conditions are met. This License explicitly affirms your unlimited 313 | permission to run the unmodified Program. The output from running a 314 | covered work is covered by this License only if the output, given its 315 | content, constitutes a covered work. This License acknowledges your 316 | rights of fair use or other equivalent, as provided by copyright law.

317 | 318 |

You may make, run and propagate covered works that you do not 319 | convey, without conditions so long as your license otherwise remains 320 | in force. You may convey covered works to others for the sole purpose 321 | of having them make modifications exclusively for you, or provide you 322 | with facilities for running those works, provided that you comply with 323 | the terms of this License in conveying all material for which you do 324 | not control copyright. Those thus making or running the covered works 325 | for you must do so exclusively on your behalf, under your direction 326 | and control, on terms that prohibit them from making any copies of 327 | your copyrighted material outside their relationship with you.

328 | 329 |

Conveying under any other circumstances is permitted solely under 330 | the conditions stated below. Sublicensing is not allowed; section 10 331 | makes it unnecessary.

332 | 333 |

3. Protecting Users' Legal Rights From Anti-Circumvention Law.

334 | 335 |

No covered work shall be deemed part of an effective technological 336 | measure under any applicable law fulfilling obligations under article 337 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 338 | similar laws prohibiting or restricting circumvention of such 339 | measures.

340 | 341 |

When you convey a covered work, you waive any legal power to forbid 342 | circumvention of technological measures to the extent such circumvention 343 | is effected by exercising rights under this License with respect to 344 | the covered work, and you disclaim any intention to limit operation or 345 | modification of the work as a means of enforcing, against the work's 346 | users, your or third parties' legal rights to forbid circumvention of 347 | technological measures.

348 | 349 |

4. Conveying Verbatim Copies.

350 | 351 |

You may convey verbatim copies of the Program's source code as you 352 | receive it, in any medium, provided that you conspicuously and 353 | appropriately publish on each copy an appropriate copyright notice; 354 | keep intact all notices stating that this License and any 355 | non-permissive terms added in accord with section 7 apply to the code; 356 | keep intact all notices of the absence of any warranty; and give all 357 | recipients a copy of this License along with the Program.

358 | 359 |

You may charge any price or no price for each copy that you convey, 360 | and you may offer support or warranty protection for a fee.

361 | 362 |

5. Conveying Modified Source Versions.

363 | 364 |

You may convey a work based on the Program, or the modifications to 365 | produce it from the Program, in the form of source code under the 366 | terms of section 4, provided that you also meet all of these conditions:

367 | 368 |
    369 |
  • a) The work must carry prominent notices stating that you modified 370 | it, and giving a relevant date.
  • 371 | 372 |
  • b) The work must carry prominent notices stating that it is 373 | released under this License and any conditions added under section 374 | 7. This requirement modifies the requirement in section 4 to 375 | “keep intact all notices”.
  • 376 | 377 |
  • c) You must license the entire work, as a whole, under this 378 | License to anyone who comes into possession of a copy. This 379 | License will therefore apply, along with any applicable section 7 380 | additional terms, to the whole of the work, and all its parts, 381 | regardless of how they are packaged. This License gives no 382 | permission to license the work in any other way, but it does not 383 | invalidate such permission if you have separately received it.
  • 384 | 385 |
  • d) If the work has interactive user interfaces, each must display 386 | Appropriate Legal Notices; however, if the Program has interactive 387 | interfaces that do not display Appropriate Legal Notices, your 388 | work need not make them do so.
  • 389 |
390 | 391 |

A compilation of a covered work with other separate and independent 392 | works, which are not by their nature extensions of the covered work, 393 | and which are not combined with it such as to form a larger program, 394 | in or on a volume of a storage or distribution medium, is called an 395 | “aggregate” if the compilation and its resulting copyright are not 396 | used to limit the access or legal rights of the compilation's users 397 | beyond what the individual works permit. Inclusion of a covered work 398 | in an aggregate does not cause this License to apply to the other 399 | parts of the aggregate.

400 | 401 |

6. Conveying Non-Source Forms.

402 | 403 |

You may convey a covered work in object code form under the terms 404 | of sections 4 and 5, provided that you also convey the 405 | machine-readable Corresponding Source under the terms of this License, 406 | in one of these ways:

407 | 408 |
    409 |
  • a) Convey the object code in, or embodied in, a physical product 410 | (including a physical distribution medium), accompanied by the 411 | Corresponding Source fixed on a durable physical medium 412 | customarily used for software interchange.
  • 413 | 414 |
  • b) Convey the object code in, or embodied in, a physical product 415 | (including a physical distribution medium), accompanied by a 416 | written offer, valid for at least three years and valid for as 417 | long as you offer spare parts or customer support for that product 418 | model, to give anyone who possesses the object code either (1) a 419 | copy of the Corresponding Source for all the software in the 420 | product that is covered by this License, on a durable physical 421 | medium customarily used for software interchange, for a price no 422 | more than your reasonable cost of physically performing this 423 | conveying of source, or (2) access to copy the 424 | Corresponding Source from a network server at no charge.
  • 425 | 426 |
  • c) Convey individual copies of the object code with a copy of the 427 | written offer to provide the Corresponding Source. This 428 | alternative is allowed only occasionally and noncommercially, and 429 | only if you received the object code with such an offer, in accord 430 | with subsection 6b.
  • 431 | 432 |
  • d) Convey the object code by offering access from a designated 433 | place (gratis or for a charge), and offer equivalent access to the 434 | Corresponding Source in the same way through the same place at no 435 | further charge. You need not require recipients to copy the 436 | Corresponding Source along with the object code. If the place to 437 | copy the object code is a network server, the Corresponding Source 438 | may be on a different server (operated by you or a third party) 439 | that supports equivalent copying facilities, provided you maintain 440 | clear directions next to the object code saying where to find the 441 | Corresponding Source. Regardless of what server hosts the 442 | Corresponding Source, you remain obligated to ensure that it is 443 | available for as long as needed to satisfy these requirements.
  • 444 | 445 |
  • e) Convey the object code using peer-to-peer transmission, provided 446 | you inform other peers where the object code and Corresponding 447 | Source of the work are being offered to the general public at no 448 | charge under subsection 6d.
  • 449 |
450 | 451 |

A separable portion of the object code, whose source code is excluded 452 | from the Corresponding Source as a System Library, need not be 453 | included in conveying the object code work.

454 | 455 |

A “User Product” is either (1) a “consumer product”, which means any 456 | tangible personal property which is normally used for personal, family, 457 | or household purposes, or (2) anything designed or sold for incorporation 458 | into a dwelling. In determining whether a product is a consumer product, 459 | doubtful cases shall be resolved in favor of coverage. For a particular 460 | product received by a particular user, “normally used” refers to a 461 | typical or common use of that class of product, regardless of the status 462 | of the particular user or of the way in which the particular user 463 | actually uses, or expects or is expected to use, the product. A product 464 | is a consumer product regardless of whether the product has substantial 465 | commercial, industrial or non-consumer uses, unless such uses represent 466 | the only significant mode of use of the product.

467 | 468 |

“Installation Information” for a User Product means any methods, 469 | procedures, authorization keys, or other information required to install 470 | and execute modified versions of a covered work in that User Product from 471 | a modified version of its Corresponding Source. The information must 472 | suffice to ensure that the continued functioning of the modified object 473 | code is in no case prevented or interfered with solely because 474 | modification has been made.

475 | 476 |

If you convey an object code work under this section in, or with, or 477 | specifically for use in, a User Product, and the conveying occurs as 478 | part of a transaction in which the right of possession and use of the 479 | User Product is transferred to the recipient in perpetuity or for a 480 | fixed term (regardless of how the transaction is characterized), the 481 | Corresponding Source conveyed under this section must be accompanied 482 | by the Installation Information. But this requirement does not apply 483 | if neither you nor any third party retains the ability to install 484 | modified object code on the User Product (for example, the work has 485 | been installed in ROM).

486 | 487 |

The requirement to provide Installation Information does not include a 488 | requirement to continue to provide support service, warranty, or updates 489 | for a work that has been modified or installed by the recipient, or for 490 | the User Product in which it has been modified or installed. Access to a 491 | network may be denied when the modification itself materially and 492 | adversely affects the operation of the network or violates the rules and 493 | protocols for communication across the network.

494 | 495 |

Corresponding Source conveyed, and Installation Information provided, 496 | in accord with this section must be in a format that is publicly 497 | documented (and with an implementation available to the public in 498 | source code form), and must require no special password or key for 499 | unpacking, reading or copying.

500 | 501 |

7. Additional Terms.

502 | 503 |

“Additional permissions” are terms that supplement the terms of this 504 | License by making exceptions from one or more of its conditions. 505 | Additional permissions that are applicable to the entire Program shall 506 | be treated as though they were included in this License, to the extent 507 | that they are valid under applicable law. If additional permissions 508 | apply only to part of the Program, that part may be used separately 509 | under those permissions, but the entire Program remains governed by 510 | this License without regard to the additional permissions.

511 | 512 |

When you convey a copy of a covered work, you may at your option 513 | remove any additional permissions from that copy, or from any part of 514 | it. (Additional permissions may be written to require their own 515 | removal in certain cases when you modify the work.) You may place 516 | additional permissions on material, added by you to a covered work, 517 | for which you have or can give appropriate copyright permission.

518 | 519 |

Notwithstanding any other provision of this License, for material you 520 | add to a covered work, you may (if authorized by the copyright holders of 521 | that material) supplement the terms of this License with terms:

522 | 523 |
    524 |
  • a) Disclaiming warranty or limiting liability differently from the 525 | terms of sections 15 and 16 of this License; or
  • 526 | 527 |
  • b) Requiring preservation of specified reasonable legal notices or 528 | author attributions in that material or in the Appropriate Legal 529 | Notices displayed by works containing it; or
  • 530 | 531 |
  • c) Prohibiting misrepresentation of the origin of that material, or 532 | requiring that modified versions of such material be marked in 533 | reasonable ways as different from the original version; or
  • 534 | 535 |
  • d) Limiting the use for publicity purposes of names of licensors or 536 | authors of the material; or
  • 537 | 538 |
  • e) Declining to grant rights under trademark law for use of some 539 | trade names, trademarks, or service marks; or
  • 540 | 541 |
  • f) Requiring indemnification of licensors and authors of that 542 | material by anyone who conveys the material (or modified versions of 543 | it) with contractual assumptions of liability to the recipient, for 544 | any liability that these contractual assumptions directly impose on 545 | those licensors and authors.
  • 546 |
547 | 548 |

All other non-permissive additional terms are considered “further 549 | restrictions” within the meaning of section 10. If the Program as you 550 | received it, or any part of it, contains a notice stating that it is 551 | governed by this License along with a term that is a further 552 | restriction, you may remove that term. If a license document contains 553 | a further restriction but permits relicensing or conveying under this 554 | License, you may add to a covered work material governed by the terms 555 | of that license document, provided that the further restriction does 556 | not survive such relicensing or conveying.

557 | 558 |

If you add terms to a covered work in accord with this section, you 559 | must place, in the relevant source files, a statement of the 560 | additional terms that apply to those files, or a notice indicating 561 | where to find the applicable terms.

562 | 563 |

Additional terms, permissive or non-permissive, may be stated in the 564 | form of a separately written license, or stated as exceptions; 565 | the above requirements apply either way.

566 | 567 |

8. Termination.

568 | 569 |

You may not propagate or modify a covered work except as expressly 570 | provided under this License. Any attempt otherwise to propagate or 571 | modify it is void, and will automatically terminate your rights under 572 | this License (including any patent licenses granted under the third 573 | paragraph of section 11).

574 | 575 |

However, if you cease all violation of this License, then your 576 | license from a particular copyright holder is reinstated (a) 577 | provisionally, unless and until the copyright holder explicitly and 578 | finally terminates your license, and (b) permanently, if the copyright 579 | holder fails to notify you of the violation by some reasonable means 580 | prior to 60 days after the cessation.

581 | 582 |

Moreover, your license from a particular copyright holder is 583 | reinstated permanently if the copyright holder notifies you of the 584 | violation by some reasonable means, this is the first time you have 585 | received notice of violation of this License (for any work) from that 586 | copyright holder, and you cure the violation prior to 30 days after 587 | your receipt of the notice.

588 | 589 |

Termination of your rights under this section does not terminate the 590 | licenses of parties who have received copies or rights from you under 591 | this License. If your rights have been terminated and not permanently 592 | reinstated, you do not qualify to receive new licenses for the same 593 | material under section 10.

594 | 595 |

9. Acceptance Not Required for Having Copies.

596 | 597 |

You are not required to accept this License in order to receive or 598 | run a copy of the Program. Ancillary propagation of a covered work 599 | occurring solely as a consequence of using peer-to-peer transmission 600 | to receive a copy likewise does not require acceptance. However, 601 | nothing other than this License grants you permission to propagate or 602 | modify any covered work. These actions infringe copyright if you do 603 | not accept this License. Therefore, by modifying or propagating a 604 | covered work, you indicate your acceptance of this License to do so.

605 | 606 |

10. Automatic Licensing of Downstream Recipients.

607 | 608 |

Each time you convey a covered work, the recipient automatically 609 | receives a license from the original licensors, to run, modify and 610 | propagate that work, subject to this License. You are not responsible 611 | for enforcing compliance by third parties with this License.

612 | 613 |

An “entity transaction” is a transaction transferring control of an 614 | organization, or substantially all assets of one, or subdividing an 615 | organization, or merging organizations. If propagation of a covered 616 | work results from an entity transaction, each party to that 617 | transaction who receives a copy of the work also receives whatever 618 | licenses to the work the party's predecessor in interest had or could 619 | give under the previous paragraph, plus a right to possession of the 620 | Corresponding Source of the work from the predecessor in interest, if 621 | the predecessor has it or can get it with reasonable efforts.

622 | 623 |

You may not impose any further restrictions on the exercise of the 624 | rights granted or affirmed under this License. For example, you may 625 | not impose a license fee, royalty, or other charge for exercise of 626 | rights granted under this License, and you may not initiate litigation 627 | (including a cross-claim or counterclaim in a lawsuit) alleging that 628 | any patent claim is infringed by making, using, selling, offering for 629 | sale, or importing the Program or any portion of it.

630 | 631 |

11. Patents.

632 | 633 |

A “contributor” is a copyright holder who authorizes use under this 634 | License of the Program or a work on which the Program is based. The 635 | work thus licensed is called the contributor's “contributor version”.

636 | 637 |

A contributor's “essential patent claims” are all patent claims 638 | owned or controlled by the contributor, whether already acquired or 639 | hereafter acquired, that would be infringed by some manner, permitted 640 | by this License, of making, using, or selling its contributor version, 641 | but do not include claims that would be infringed only as a 642 | consequence of further modification of the contributor version. For 643 | purposes of this definition, “control” includes the right to grant 644 | patent sublicenses in a manner consistent with the requirements of 645 | this License.

646 | 647 |

Each contributor grants you a non-exclusive, worldwide, royalty-free 648 | patent license under the contributor's essential patent claims, to 649 | make, use, sell, offer for sale, import and otherwise run, modify and 650 | propagate the contents of its contributor version.

651 | 652 |

In the following three paragraphs, a “patent license” is any express 653 | agreement or commitment, however denominated, not to enforce a patent 654 | (such as an express permission to practice a patent or covenant not to 655 | sue for patent infringement). To “grant” such a patent license to a 656 | party means to make such an agreement or commitment not to enforce a 657 | patent against the party.

658 | 659 |

If you convey a covered work, knowingly relying on a patent license, 660 | and the Corresponding Source of the work is not available for anyone 661 | to copy, free of charge and under the terms of this License, through a 662 | publicly available network server or other readily accessible means, 663 | then you must either (1) cause the Corresponding Source to be so 664 | available, or (2) arrange to deprive yourself of the benefit of the 665 | patent license for this particular work, or (3) arrange, in a manner 666 | consistent with the requirements of this License, to extend the patent 667 | license to downstream recipients. “Knowingly relying” means you have 668 | actual knowledge that, but for the patent license, your conveying the 669 | covered work in a country, or your recipient's use of the covered work 670 | in a country, would infringe one or more identifiable patents in that 671 | country that you have reason to believe are valid.

672 | 673 |

If, pursuant to or in connection with a single transaction or 674 | arrangement, you convey, or propagate by procuring conveyance of, a 675 | covered work, and grant a patent license to some of the parties 676 | receiving the covered work authorizing them to use, propagate, modify 677 | or convey a specific copy of the covered work, then the patent license 678 | you grant is automatically extended to all recipients of the covered 679 | work and works based on it.

680 | 681 |

A patent license is “discriminatory” if it does not include within 682 | the scope of its coverage, prohibits the exercise of, or is 683 | conditioned on the non-exercise of one or more of the rights that are 684 | specifically granted under this License. You may not convey a covered 685 | work if you are a party to an arrangement with a third party that is 686 | in the business of distributing software, under which you make payment 687 | to the third party based on the extent of your activity of conveying 688 | the work, and under which the third party grants, to any of the 689 | parties who would receive the covered work from you, a discriminatory 690 | patent license (a) in connection with copies of the covered work 691 | conveyed by you (or copies made from those copies), or (b) primarily 692 | for and in connection with specific products or compilations that 693 | contain the covered work, unless you entered into that arrangement, 694 | or that patent license was granted, prior to 28 March 2007.

695 | 696 |

Nothing in this License shall be construed as excluding or limiting 697 | any implied license or other defenses to infringement that may 698 | otherwise be available to you under applicable patent law.

699 | 700 |

12. No Surrender of Others' Freedom.

701 | 702 |

If conditions are imposed on you (whether by court order, agreement or 703 | otherwise) that contradict the conditions of this License, they do not 704 | excuse you from the conditions of this License. If you cannot convey a 705 | covered work so as to satisfy simultaneously your obligations under this 706 | License and any other pertinent obligations, then as a consequence you may 707 | not convey it at all. For example, if you agree to terms that obligate you 708 | to collect a royalty for further conveying from those to whom you convey 709 | the Program, the only way you could satisfy both those terms and this 710 | License would be to refrain entirely from conveying the Program.

711 | 712 |

13. Use with the GNU Affero General Public License.

713 | 714 |

Notwithstanding any other provision of this License, you have 715 | permission to link or combine any covered work with a work licensed 716 | under version 3 of the GNU Affero General Public License into a single 717 | combined work, and to convey the resulting work. The terms of this 718 | License will continue to apply to the part which is the covered work, 719 | but the special requirements of the GNU Affero General Public License, 720 | section 13, concerning interaction through a network will apply to the 721 | combination as such.

722 | 723 |

14. Revised Versions of this License.

724 | 725 |

The Free Software Foundation may publish revised and/or new versions of 726 | the GNU General Public License from time to time. Such new versions will 727 | be similar in spirit to the present version, but may differ in detail to 728 | address new problems or concerns.

729 | 730 |

Each version is given a distinguishing version number. If the 731 | Program specifies that a certain numbered version of the GNU General 732 | Public License “or any later version” applies to it, you have the 733 | option of following the terms and conditions either of that numbered 734 | version or of any later version published by the Free Software 735 | Foundation. If the Program does not specify a version number of the 736 | GNU General Public License, you may choose any version ever published 737 | by the Free Software Foundation.

738 | 739 |

If the Program specifies that a proxy can decide which future 740 | versions of the GNU General Public License can be used, that proxy's 741 | public statement of acceptance of a version permanently authorizes you 742 | to choose that version for the Program.

743 | 744 |

Later license versions may give you additional or different 745 | permissions. However, no additional obligations are imposed on any 746 | author or copyright holder as a result of your choosing to follow a 747 | later version.

748 | 749 |

15. Disclaimer of Warranty.

750 | 751 |

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 752 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 753 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY 754 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 755 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 756 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 757 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 758 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

759 | 760 |

16. Limitation of Liability.

761 | 762 |

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 763 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 764 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 765 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 766 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 767 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 768 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 769 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 770 | SUCH DAMAGES.

771 | 772 |

17. Interpretation of Sections 15 and 16.

773 | 774 |

If the disclaimer of warranty and limitation of liability provided 775 | above cannot be given local legal effect according to their terms, 776 | reviewing courts shall apply local law that most closely approximates 777 | an absolute waiver of all civil liability in connection with the 778 | Program, unless a warranty or assumption of liability accompanies a 779 | copy of the Program in return for a fee.

780 | 781 |

END OF TERMS AND CONDITIONS

782 | 783 |

How to Apply These Terms to Your New Programs

784 | 785 |

If you develop a new program, and you want it to be of the greatest 786 | possible use to the public, the best way to achieve this is to make it 787 | free software which everyone can redistribute and change under these terms.

788 | 789 |

To do so, attach the following notices to the program. It is safest 790 | to attach them to the start of each source file to most effectively 791 | state the exclusion of warranty; and each file should have at least 792 | the “copyright” line and a pointer to where the full notice is found.

793 | 794 |
    <one line to give the program's name and a brief idea of what it does.>
795 |     Copyright (C) <year>  <name of author>
796 | 
797 |     This program is free software: you can redistribute it and/or modify
798 |     it under the terms of the GNU General Public License as published by
799 |     the Free Software Foundation, either version 3 of the License, or
800 |     (at your option) any later version.
801 | 
802 |     This program is distributed in the hope that it will be useful,
803 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
804 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
805 |     GNU General Public License for more details.
806 | 
807 |     You should have received a copy of the GNU General Public License
808 |     along with this program.  If not, see <http://www.gnu.org/licenses/>.
809 | 
810 | 811 |

Also add information on how to contact you by electronic and paper mail.

812 | 813 |

If the program does terminal interaction, make it output a short 814 | notice like this when it starts in an interactive mode:

815 | 816 |
    <program>  Copyright (C) <year>  <name of author>
817 |     This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
818 |     This is free software, and you are welcome to redistribute it
819 |     under certain conditions; type `show c' for details.
820 | 
821 | 822 |

The hypothetical commands `show w' and `show c' should show the appropriate 823 | parts of the General Public License. Of course, your program's commands 824 | might be different; for a GUI interface, you would use an “about box”.

825 | 826 |

You should also get your employer (if you work as a programmer) or school, 827 | if any, to sign a “copyright disclaimer” for the program, if necessary. 828 | For more information on this, and how to apply and follow the GNU GPL, see 829 | <http://www.gnu.org/licenses/>.

830 | 831 |

The GNU General Public License does not permit incorporating your program 832 | into proprietary programs. If your program is a subroutine library, you 833 | may consider it more useful to permit linking proprietary applications with 834 | the library. If this is what you want to do, use the GNU Lesser General 835 | Public License instead of this License. But first, please read 836 | <http://www.gnu.org/philosophy/why-not-lgpl.html>.

837 | 838 |
839 | 840 |
841 | 842 | 843 | 854 | 855 |
856 | 857 |
858 |

 [FSF logo] “Our 860 | mission is to preserve, protect and promote the freedom to use, study, 861 | copy, modify, and redistribute computer software, and to defend the 862 | rights of Free Software users.”

863 |
864 | 865 |

The Free Software Foundation is 866 | the principal organizational sponsor of the GNU Operating System. 867 | Support GNU and the FSF by buying manuals and gear, 870 | joining the FSF as an associate member, or making 871 | a donation, either directly to the FSF or via 874 | Flattr.

875 | 876 |

back to top

877 | 878 |
879 | 880 | 881 | 882 | 948 |
949 | 950 | 951 | -------------------------------------------------------------------------------- /tests/test_neocities.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | 4 | import neocities 5 | 6 | # Bonus: Running these tests enough times will likely get you banned! 7 | 8 | 9 | class NeoCitiesTestCase(unittest.TestCase): 10 | def setUp(self): 11 | auth = (os.environ['NEOCITIES_USER'], 12 | os.environ['NEOCITIES_PASS']) 13 | self.nc = neocities.NeoCities(*auth) 14 | 15 | def test_info_no_auth(self): 16 | self.nc = neocities.NeoCities() 17 | response = self.nc.info('blog') 18 | self.assertEqual(response['result'], 'success') 19 | 20 | """ 21 | Tests from this point on require you to have a NeoCities.org account 22 | """ 23 | 24 | def test_info_auth(self): 25 | response = self.nc.info() 26 | self.assertEqual(response['result'], 'success') 27 | 28 | def test_upload_and_delete(self): 29 | """ 30 | I would usually refrain from testing multiple things at once but order 31 | is very important in this case 32 | """ 33 | response = self.nc.upload(('tests/fixtures/cat.png', 'neko.png'), 34 | ('tests/fixtures/gpl.html', 'gpl.html')) 35 | self.assertEqual(response['result'], 'success') 36 | response = self.nc.delete('neko.png', 'gpl.html') 37 | self.assertEqual(response['result'], 'success') 38 | --------------------------------------------------------------------------------