Package: uploadgrampyapi
UploadgramPyAPIThis API can upload, download, remove and rename any files from the serviceuploadgram.me- a simple and fast file uploader that uses Telegram network as file storage.If you download this module, you confirm your agreement with theTerms of ServiceandDMCA PolicyofUploadgram.meAuthor:tankalxat34InstallIn your CMD perform this command:pip install UploadgramPyAPIQuickstartUpload any fileimportUploadgramPyAPIup_file=UploadgramPyAPI.NewFile("D:\\image.jpg")up_file.upload()Delete any fileimportUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")up_file.delete()Rename any fileimportUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")up_file.rename("ItsNewNameForFile.jpg")Download any fileimportUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")up_file.download()UsingNow we can looking, how to use UploadgramPyAPIUpload new fileStep 1Firstly, you need to import the library:importUploadgramPyAPIStep 2Next if you want to upload new file on uploadgram.me you need write this in your file:up_file=UploadgramPyAPI.NewFile("D:\\image.jpg")This string will preparing your file to upload.Step 3Write this line after the previous one.up_file.upload()Now fileimage.jpgwas uploaded in uploadgram.me and you was get the dictionary like here{"ok":"true","url":"https://dl.uploadgram.me/611e5e6237f6fg","delete":"e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g"}UploadgramPyAPI can parse this json-responce and create new attributes:url,keyandurl_import.Important thingAttributekeyis a very important string for renaming and removing the file. You need to save its, else you won't do it.Attributeurl_importit's a simple url for import your file in a dashboard inhttps://dl.uploadgram.me.
Its look like this:https://uploadgram.me/upload/#import:{"e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g": {"filename": "image.jpg", "size": 55604, "url": "https://dl.uploadgram.me/611e5e6237f6fg"}}Open this url in your browser and uploaded file will appear on the website! You can see something like this:So your code can be looking like this:importUploadgramPyAPIup_file=UploadgramPyAPI.NewFile("D:\\image.jpg")up_file.upload()Delete fileAlso you can delete the file. Look!Step 1If you have thekeyattribute for the file, you can delete its!Firstly, you need to write this strings for connect to server and file on it:importUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")up_file.delete()Last string deleted theimage.jpgfromuploadgram.me. If you want to make sure, you can openurlin your browser. You will get the 404-error:Rename fileUploadgramPyAPI can rename the file.We need use thekeyattribute for rename the file.The beginning is the same as in the previous steps:importUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")# this string will rename the filenameup_file.rename("ItsNewNameForFile.jpg")And now you can see this situation:Download fileYou can download the file from server:importUploadgramPyAPIup_file=UploadgramPyAPI.File("611e5e6237f6fg","e3da26e9dddd2e01b8c0831370695e9088a96ff81e262fc2g")# this string will help download the file in the default download's folderup_file.download()File will appear in the download's folder:Also you can write path to save file:up_file.download("D:\\MyMainFolder\\")It's enough! Successful use of the UploadgramPyAPI library!