Hi,
I would like to use python to upload a updated mod release to the mod portal.
Assuming the package is valid and does not exist on the portal i would expect the following steps to work:
0. Using a single session
1. log in at https://auth.factorio.com/api-login and obtain an auth_token
2. log into mod portal https://mods.factorio.com/login
3. Get upload token https://mods.factorio.com/mod/myModName/downloads/edit (fails, I get another login page)
... is there an working example or wiki page on this topic somewhere ?
Edit: Full Non-working example availiable at https://github.com/nicolas-lang/Factori ... er/test.py
How to upload a new release to the mod-portal (using python)
How to upload a new release to the mod-portal (using python)
Last edited by Karoschl on Sat Jun 12, 2021 10:36 pm, edited 2 times in total.
Re: [Question] How to upload a new release to the mod-portal (using python)
There isn’t an official API for this, but there are several GitHub actions and a VSCode extension that may contain what you are looking for.
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: [Question] How to upload a new release to the mod-portal (using python)
I started doing my own code since i failed to get the preexisting stuff to work.
I initially started using https://github.com/Roang-zero1/factorio ... ase-action but that failes with strange errors related to the cssrf token
after some checking of the various examples i found
and to me it seems all kind of the same and also somehow different, and none of the ones I tested worked.
Based on that I started looking for documentation and was discouraged by https://wiki.factorio.com/Web_authentication_API
At the moment I am mostly confused by the information I have found:
I initially started using https://github.com/Roang-zero1/factorio ... ase-action but that failes with strange errors related to the cssrf token
Code: Select all
sh: id="csrf_token": unknown operand
parse error: Invalid numeric literal at line 1, column 10
sh: null: unknown operand
Based on that I started looking for documentation and was discouraged by https://wiki.factorio.com/Web_authentication_API
At the moment I am mostly confused by the information I have found:
- do I need the login api https://auth.factorio.com/api-login at all?
- should i call https://factorio.com/login?mods=1 or https://mods.factorio.com/login
- username or username_or_email
- token or password
- why is half of the process nice json and the other half xpath/regex crap with non-api html pages
- why does the login page require a csrf_token but not the login api
- what describes a successfully logged-in session
Re: [Question] How to upload a new release to the mod-portal (using python)
The vscode extension works for me: https://github.com/justarandomgeek/vsco ... er.ts#L530
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: [Question] How to upload a new release to the mod-portal (using python)
Thanks a lot Bilka, that is a good place to start!
The "api" still looks it bit scary with all that html-regex, but i can work with that
I'll provide an update when i run into the next issue or when it works !
The "api" still looks it bit scary with all that html-regex, but i can work with that
I'll provide an update when i run into the next issue or when it works !
Re: [Question] How to upload a new release to the mod-portal (using python)
I got it working, just some cleanup and I'll share the code.
Thanks a lot
Thanks a lot
Re: [Question] How to upload a new release to the mod-portal (using python)
Example code and demo mod to showcase deployment using python & github workflows.
Very similiar to examples by Roang-zero1, Nexela, and Shane Madden but based on python and with slightly more logging.
Very similiar to examples by Roang-zero1, Nexela, and Shane Madden but based on python and with slightly more logging.