Skip to main content

official api wrapper for you.com and all of its apps

Project description


YouDotCom

YouDotCom for python v1.2.0

An python library for you.com and all of its apps.

Python Version Dependencies Status

Code style: black Security: bandit Pre-commit Semantic Versions License Coverage Report

AboutKey FeaturesHow To UseInstallCreditsLicense

About

Welcome to the YouDotCom Python Library!

This library allows users to easily access and utilize all of the functionality of the You.com platform through a simple and intuitive Python interface. With the library, users can access a variety of You.com apps and services, including but not limited to:

  • Search
  • YouChat
  • YouCode
  • YouWrite

To get started with the YouDotCom Python Library, simply install the package using pip and import it into your Python script. From there, you can use the provided functions and classes to easily interact with the You.com platform.

We hope you enjoy using the YouDotCom Python Library and all of the features it has to offer!

by Chat GPT

Key Features

  • Bypass CloudFlare
  • Interact with YouChat
  • Find code examples
  • Server ready
    • Supports non-gui operating systems.
  • Cross platform
    • Windows, macOS and Linux ready.

How to install

To install the YouDotCom Python Library, use the following command:

pip install youdotcom

This will install the latest version of the youdotcom package. Always make sure to be up-to-date so you don't miss any features, use:

pip install youdotcom --upgrade

Once the installation is complete, you can use the youdotcom package in your Python scripts by importing it:

import youdotcom

How To Use

To help users get started with the YouDotCom Python Library, we have provided a selection of code examples that demonstrate common use cases for the library. These examples can be found below and cover a range of functionality.

To use the code examples, simply copy and paste the relevant code into your Python script and customize it to fit your specific needs. You can also use the examples as a starting point for your own code, using them as a guide to understand how the library functions can be used to build your own applications and integrations with the You.com platform.

We hope that these code examples will make it easier for users to get up and running with the YouDotCom Python Library and start building with the You.com platform.

:warning: Warning! Do not spam or harm the you.com servers in any way!

YouChat example


YouChat

Note YouChat is currently disabled because you.com does not yet support the trafic.

from youdotcom import Chat # import all the classes

chat = Chat.send_message(message="how is your day?", api_key="YOUR API KEY HERE") # send a message to YouChat. passing the message and your api key.

# you can get an api key form the site: https://api.betterapi.net/ (with is also made by me)

print(chat)  # returns the message and some other data

Context

Note at the moment there is no context support YET. becuase of new api.

Note Your context will not always be used in the response message is is not a code bug but a YouChat thing. Note its still in beta

YouDotCom's YouChat feature is a powerful tool that allows for context to be utilized in your conversations. By passing a list or a file in the JSON format, you can provide the chatbot with additional information to better understand and respond to your questions.

To use the context option, you can change the way you send your message by changing the Chat.send_message method. This method allows you to pass in a driver, a message, and a context_form_file or a context parameter.

For example, if you want to use a file, you can pass the file name as the context_form_file parameter, like this:

Chat.send_message(driver=driver, message="YOUR QUESTION HERE", context_form_file="FILE_NAME.json")

Make sure to change the FILE_NAME to the name of the file you are using and include a question in the message parameter.

Alternatively, you can also use the context directly without a file by passing in a list as the context parameter. Like this:

Chat.send_message(driver=driver, message="YOUR QUESTION HERE", context=['context #1', '#2', 'etc...'])

By providing context to your conversations, you can expect more accurate and personalized responses from YouChat, which can help to improve your overall experience.

The following is an example of a JSON file that can be used as the context_form_file parameter in the Chat.send_message method:

{  
    "context": [ 
        "my name is test",
        "i love coding",
        "my hobby's are making pictures in nature"
    ]  
}  

In this example, the context field contains an array of strings that provide additional information about the user. The strings can include any relevant information that could help the chatbot understand the context of the conversation.

YouCode example


YouCode

Find code

from youdotcom import Webdriver, Code # import all the classes

driver = Webdriver().driver # setting up the webdriver. use `webdriver_path=` if the pre-installed one does not work.

code = Code.find_code(driver, search="how to make an python loop?") # get all the code displayed on screen. passing the driver and search string.

for string in code['response']: # loop through all the code
    print(string) # print 1 at an time.
    
print(code['time']) # print the time taken to complete you search.

This code imports the Code and Webdriver classes from the youdotcom library. The Code class is used to search for code snippets, while the Webdriver class is used to set up a webdriver.

First, the Webdriver class is instantiated with Webdriver(). The driver attribute of the resulting object is then stored in the driver variable. The driver attribute returns a webdriver object that can be used to automate web browsing tasks.

Next, the find_code method of the Code class is called with driver and a search string as arguments. This method searches for code snippets related to the specified search string using the webdriver. The result of the method call is stored in the code variable.

The code variable is a dictionary containing a list of code snippets in the response field and the time taken to complete the search in the time field. The code then loops through the response list and prints each code snippet to the console one at a time. Finally, the time taken to complete the search is printed to the console.


Generate code

Note Code complete has an daily limit of 20 requests.

from youdotcom import Code # import the write class 

text = Code.gen_code("python loop") # make an api call

print(text['response']) # print the AI made code

print(text['time']) # print total time taken to complete your request

This code imports the Code class from the youdotcom module. It then calls the gen_code method of the Code class, passing in the string "python loop" as an argument. The gen_code method makes an API call and returns a dictionary with two keys: response and time. The code then prints the value associated with the response key, which is the AI-generated code. It also prints the value associated with the time key, which is the total time taken to complete the request.

Search example
from youdotcom import Search # import the Search class

search_results = Search.search_for("how to make an python loop?") # search! No need to use the Webdriver class.

print(search_results['results']) # print all the search results

print(search_results['time']) # print the total time taken (les then 3 seconds on average)

This code imports the Search class from the youdotcom module. It then calls the search_for method of the Search class, passing in the string "how to make an python loop?" as an argument. The search_for method returns a dictionary with two keys: results and time. The code then prints the value associated with the results key, which is a list of search results. It also prints the value associated with the time key, which is the total time taken to perform the search.

YouWrite example


YouCode

Note YouWrite has an daily limit of 10 requests.

from youdotcom import Write # import the write class 

text = Write.write("how to write well?") # make an api call

print(text['response']) # print the AI made text

print(text['time']) # print total time taken to complete your request

This code imports the Write class from the youdotcom module. It then calls the write method of the Write class, passing in the string "how to write well?" as an argument. The write method makes an API call and returns a dictionary with two keys: response and time. The code then prints the value associated with the response key, which is a text generated by an AI. It also prints the value associated with the time key, which is the total time taken to complete the request.

Note YouDotCom is in Alpha and there will be bugs!

Interactive shell

The YouDotCom python library offers a wide range of functionality to its users, and one of the ways in which users can access and utilize this functionality is through an interactive terminal shell. With the interactive shell, users are able to execute commands and manipulate the library in real-time, allowing for a more flexible and dynamic experience.

to use the interactive shell, use the following command in your terminal:

youdotcom

you will get something like this:

Welcome to YouShell an interactive shell for all YouDotCom commands
Enter 'help' for a list of available commands.
Type 'exit' to stop.


YouShell >

Note You may sometimes get the following error message:

Detected a Cloudflare version 2 Captcha challenge, This feature is not available in the opensource (free) version.

API

Note The request limit is 5 per minute.

Welcome to the YouDotCom Python library! Our library now features an easy-to-use public API that allows you to interact with YouChat. With this API, you can easily integrate YouChat into your own projects and applications, providing a convenient and user-friendly way for your users to access and utilize the capabilities of the chat bot.

To get started, you will first need to register for an API key on our website. This key will be required to authenticate each API request.

base url: api.betterapi.net

To send a message to YouChat and receive a JSON response, you can make an HTTP GET request to the endpoint /youdotcom/chat, including the message to be sent as a query parameter. The key is message and the value should be the message text encoded in URL format. For example, to send the message hello there, the endpoint would be /youdotcom/chat?message=hello%20there. The JSON response will include the message sent by YouChat, time, v2Captcha, and type of the request.

Another endpoint is provided to convert the output text into speech, the endpoint is /youdotcom/cts. The message to be converted should be included as a query parameter in the URL, with the key message and the value being the message text. For example, to convert the message hello there into speech, the endpoint would be /youdotcom/cts?message=hello%20there

Make sure to include the API key in the url of each request to authenticate it.

We are constantly improving and updating the YouDotCom library and API, so make sure to check back for new features and updates. If you have any questions or need assistance, feel free to reach out in the Discusions tab. I'm always happy to help.

YouDotCom roadmap

  • add youchat
  • add youcode
  • swith to using you.com/api
  • make code faster
  • add code translate
  • add all of you.com apps

Why You.com?

Discord

In addition to the YouDotCom Python Library, we also have an active Discord server where you can chat with developers and get help with using the library. Our Discord community is a great place to ask questions, share your projects, and get feedback from other developers.

Credits

This software uses the following open source packages:

License

MIT


Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youdotcom-2.0.11.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

youdotcom-2.0.11-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file youdotcom-2.0.11.tar.gz.

File metadata

  • Download URL: youdotcom-2.0.11.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Linux/5.19.0-1012-raspi

File hashes

Hashes for youdotcom-2.0.11.tar.gz
Algorithm Hash digest
SHA256 c0a5e192a540bc1b4704e4b48654814c9e3184dd919106e6c0a4dbb9ddad17d0
MD5 d5950440c42597e97bd74929a993b29f
BLAKE2b-256 a362647872e18fb6f2c36da31b152f3e3e308f0dfe37218cedcf1b47df229c5b

See more details on using hashes here.

File details

Details for the file youdotcom-2.0.11-py3-none-any.whl.

File metadata

  • Download URL: youdotcom-2.0.11-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Linux/5.19.0-1012-raspi

File hashes

Hashes for youdotcom-2.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 40d8266d6435e9b5036cebcc9e466e40d3c2cbde6bda498ff7b9f3e36329b49e
MD5 391d397dedaecd445f93f045226415f5
BLAKE2b-256 a77c27c9530240e4ea78d9a8a5c78e494dd153224721ed753debaab92e84f2dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page