Gosh, and we were doing so well. After managing a record seven of our “monthly” newsletters back in 2016, it’s mid-September and we haven’t sent a single one so far this year :-( Well, better late than never! Let’s see what’s been going on.
The PythonAnywhere API¶
Our API is now in public beta! Just go to the “API token” tab on the “Account” page to generate a token and get started.
You can do lots with it already:
- Create, reload and reconfigure websites: our very own Harry has written a neat script that allows you to create a completely new Django website, with a virtualenv, using it.
- Get links to share files from your PythonAnywhere file storage with other people
- List your consoles, and close them.
We’re planning to add API support for creating, modifying and deleting scheduled tasks very soon.
Other nifty new stuff, part 1¶
You might have noticed something new in that description of the API calls. You might have asked yourself “what’s all this about sharing files? I don’t remember anything about that.”
You’re quite right – it’s a new thing, you can now generate a sharing link for any file from inside the PythonAnywhere editor. Send the link to someone else, and they’ll get a page allowing them to copy it into their own account. Let us know if you find it useful :-)
Other nifty stuff, part 2¶
Of course, no Python developer worth their salt would ever consider using an old version of the language. In particular, we definitely don’t have any bits of Python 2.7 lurking in our codebase. Definitely not. Nope.
Anyway, adding Python 3.6 support was super-high priority for us – and it went live earlier on this year.
One important thing – it’s only supported in our “dangermouse” system image. If your account was created in the last year, you’re already using dangermouse, so you’ll already have it. But if your account is older, and you haven’t switched over yet, maybe it’s time? Just drop us a line.
The inside scoop from the blog and the forums¶
- A tutorial from Giles: building a simple Telegram bot using PythonAnywhere
- One of our loadbalancers was blocked by the Russian government due to someone hosting a naughty site on our systems. We rapidly moved everyone who was affected over to a new one, of course.
- Interested in using Dash on PythonAnywhere? Harry worked it out.
- What’s better than an octupus that can predict football results? A Python that can predict tennis results!
- Running scheduled tasks in a virtualenv can be tricky. There’s a simple way that will work most of the time, but if you’re setting environment variables in a postactivate script, you need a slightly more complicated command.
- Web requests, how do they work? Giles knows (apparently).
- If you’re writing a web scraper and want to be able to download large files, user vinasia’s suggestions will be helpful.
- Scientists, especially of the data- subspecies, are becoming keen on Julia, a language focused on numerical computing. User VizenTech got it working on PythonAnywhere.
Some new help pages¶
A couple of new pages from our ever-expanding collection:
- Having problems with your connection to MySQL databases, especially from a website? This page is for you.
- Sometimes it can be hard to work out where all of your disk space has gone. Here are some hints and tricks.
Although you can install Python packages on PythonAnywhere yourself, we like to make sure that we have plenty of batteries included.
We haven’t installed any new system modules for Python 2.7, 3.3, 3.4 or 3.5 recently – but we have installed everything we thought might be useful as part of our Python 3.6 install :-)
New whitelisted sites¶
Paying PythonAnywhere customers get unrestricted Internet access, but if you’re a free PythonAnywhere user, you may have hit problems when writing code that tries to access sites elsewhere on the Internet. We have to restrict you to sites on a whitelist to stop hackers from creating dummy accounts to hide their identities when breaking into other people’s websites.
But we really do encourage you to suggest new sites that should be on the whitelist. Our rule is, if it’s got an official public API, which means that the site’s owners are encouraging automated access to their server, then we’ll whitelist it. Just drop us a line with a link to the API docs.
We’ve added too many sites to list since our last newsletter to list them all – but please keep them coming!
That’s all for now¶
That’s all we’ve got this time around. We have some big new features in the pipeline, so keep tuned! Maybe we’ll even get our next newsletter out in October :-)