Python API for

AJ Bowen 213b197111 Merge pull request #8 from sharph/feature/csh/os-walk 2 years ago
neocities 1d15fd91a0 cli push: Use os.walk instead of glob; upload with full path 2 years ago
tests 1f3e8bc80d Fix order of arguments in nc.upload() in documentation and unit tests 3 years ago
.gitignore af2ed74e4f First commit 7 years ago
Dockerfile 5bc6b2b3e1 nc should be a global 5 years ago
LICENSE af2ed74e4f First commit 7 years ago
Makefile af2ed74e4f First commit 7 years ago b989b85f83 Updated to use neocities API keys 2 years ago fda2c5afe2 move requirements.txt to 5 years ago

python-neocities - Python API for

python-neocities is a Python wrapper of the REST API. is a FLOSS service which offers 20 Megabytes of gratis and ad-free hosting inspired by GeoCities. I really liked their approach so I decided to contribute this little API.

To install it, type python install or make install.

The unit tests rely on having a account. To run them, type


But then again, I wouldn't recommend running them at all since they might make you seem suspicious to NC's admins and the API is simple enough.


First, you must initialize a NeoCities object with

import neocities

nc = neocities.NeoCities('username', 'password')

Or you can initialize a NeoCities object using an API key with

import neocities

nc = neocities.NeoCities(api_key='NEOCITIES_API_KEY')

(Passing a valid username and password, or API key, is not necessary if you are only going to use the info call)

After you've done that, you can query NeoCities for information about a specific site with:

response ='sitename')

If you have provided correct login credentials, you can also query NeoCities for your own site's info with

response =

You can upload files with

nc.upload(('name_on_disk', 'name_on_server'), ...)

Where name_on_server is the name you want the file to have on the NeoCities server and name_on_disk is the name (path) of the file on your disk.

You can delete a file remotely with

nc.delete('filename1', ...)

To make sure you are not doing something wrong, the InvalidRequestError exception will be fired when you do. It has a status_code attribute which contains the status code returned by your request. For a list of status codes (useful to debug your requests), check out this Wikipedia page.